SUBDIRS = api
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


help-lyxport:
	@echo "Run 'make lyxport' to run lyxport on $(LYXPORT_FILES)."

LYXPORT_FILES = s11n.lyx
include $(TOC_MAKESDIR)/LYXPORT.make
LYXPORT-post:
	@echo "post-lyxport ..."; \
	for l in $(LYXPORT_FILES); do \
	for x in pdf ps html; do \
		base=$${l%%.lyx}; \
		cmd="mv $$base.$$x $$base-$(PACKAGE_VERSION).$$x"; \
		echo $$cmd; $$cmd || exit; \
	done; \
	done

lyxportgend = $(wildcard *.ps *.pdf *.html)

CLEAN_FILES += $(lyxportgend)
all: subdirs help-lyxport


lyxportgend = $(wildcard *.pdf *.html *.ps)
ifneq (,$(lyxportgend))
  RSYNC_TARGETS = docs_for_s11n
  RSYNC_FLAGS = -v
  docs_for_s11n_RSYNC_FILES = $(lyxportgend) $(wildcard $(PACKAGE_NAME)-$(PACKAGE_VERSION)-alldocs.tar.*)
  docs_for_s11n_RSYNC_DEST = $(top_srcdir)/www/s11n.net/download
  include $(TOC_MAKESDIR)/RSYNC.make
endif


ifneq (,$(lyxportgend))
################################################################
# 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)/,$(lyxportgend) api/doxygen)
include $(TOC_MAKESDIR)/TARBALL.make
# /doc tarball
################################################################
endif
# ^^^ TARBALL stuff
