include toc.make

DIST_FILES += s11n.lyx

INSTALL_DOCS += s11n.lyx

bonus_docs = $(wildcard *.pdf *.ps *.html)
ifneq (,$(bonus_docs))
    INSTALL_DOCS += $(bonus_docs)
endif


########################################################################
# LyX export...
ifneq (,$(LYX_BIN))
LYX_EXPORT = s11n
LYX_EXPORT_FORMATS = pdf html ps
LYX_EXPORT-post:
	@echo "Renaming and patching exported lyx files..."
	@perl -i -pe s/s11n\.html\#/\#/g s11n.html; \
	for y in $(LYX_EXPORT); do \
		for f in $(LYX_EXPORT_FORMATS); do \
			cmd="mv $$y.$$f $$y-$(PACKAGE_VERSION).$$f"; \
			echo $$cmd; $$cmd || exit; \
		done; \
	done
include $(TOC_MAKESDIR)/LYX_EXPORT.make
CLEAN_FILES += $(wildcard *.html *.pdf *.ps)
endif
# ^^^^ LYX_BIN
########################################################################

################################################################
# doc tarball
lyxportgend = $(wildcard *.ps *.pdf *.html)
ifneq (,$(lyxportgend))
tbname = $(PACKAGE_NAME)-manual-$(PACKAGE_VERSION)
pseudosubdir = $(tbname)
$(pseudosubdir):
	ln -s . $@
CLEAN_FILES += $(pseudosubdir)
.PHONY: doxygen
TARBALL: $(pseudosubdir)
TARBALL-%: $(pseudosubdir)
TARBALL_TARGETS = docs_gz docs_bz
docs_bz_TARBALL = $(tbname).tar.bz2
docs_bz_TARBALL_FLAGS = -j
docs_bz_TARBALL_FILES = $(addprefix $(pseudosubdir)/,$(lyxportgend))
docs_gz_TARBALL_FLAGS = -z
docs_gz_TARBALL = $(tbname).tar.gz
docs_gz_TARBALL_FILES = $(addprefix $(pseudosubdir)/,$(lyxportgend))

include $(TOC_MAKESDIR)/TARBALL.make
TARBALL: rm-symlink
rm-symlink:
	rm $(pseudosubdir)
endif
# /tarball stuff
################################################################

all: help-lyxport

lyxport: lyx # <--- backwards compat. Some docs say to use lyxport.
help-lyxport:
	@echo "Run 'make lyx' to export LyX files."



