include toc.make

DIST_FILES += class_loader.lyx cllite.lyx

INSTALL_DOCS += class_loader.lyx

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


########################################################################
# LyX export...
ifneq (,$(LYX_BIN))
LYX_EXPORT = class_loader cllite
LYX_EXPORT_FORMATS = pdf html ps
LYX_EXPORT-post:
	@echo "Renaming and patching exported lyx files..."
	@foo=$$(ls *.html); test "x" != "x$$foo" && perl -i -pe 's/([a-zA-Z_])+\.html\#/\#/g' *.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
########################################################################


######################## copy docs to s11n web site:
distdocs = $(wildcard $(addprefix $(PACKAGE_NAME)-$(PACKAGE_VERSION),*.pdf *.html *.ps))
ifneq (,$(distdocs))
  RSYNC_TARGETS = docs_for_s11n
  RSYNC_DEST = ${HOME}/cvs/s11n/www/s11n.net/download
  RSYNC_FLAGS = -v
  docs_for_s11n_RSYNC_FILES = $(distdocs) $(wildcard $(PACKAGE_NAME)-$(PACKAGE_VERSION)-alldocs.tar.*)
  include $(TOC_MAKESDIR)/RSYNC.make
endif
######################## /copy docs


################################################################
# doc tarball
pseudosubdir = $(PACKAGE_NAME)-$(PACKAGE_VERSION)
$(pseudosubdir):
	ln -s . $@
CLEAN_FILES += $(pseudosubdir)
.PHONY: doxygen
doxygen:
	test -e api/doxygen/index.html && exit 0; ${MAKE} -C api
TARBALL: $(pseudosubdir) doxygen
TARBALL-%: $(pseudosubdir) doxygen
TARBALL_TARGETS = docs
TARBALL_FLAGS = -z
docs_TARBALL = $(PACKAGE_NAME)-$(PACKAGE_VERSION)-alldocs.tar.gz
docs_TARBALL_FILES = $(addprefix $(pseudosubdir)/,$(distdocs) api/doxygen)
include $(TOC_MAKESDIR)/TARBALL.make
# /doc tarball
################################################################
