1# documentation sources
2DOCSOURCES = doc/manual.xml doc/version.xml doc/reldate.xml \
3    doc/ref/zbarimg.xml doc/ref/zbarcam.xml doc/ref/commonoptions.xml
4
5MAINTAINERCLEANFILES += doc/man/man.stamp doc/version.xml doc/reldate.xml
6
7# man page targets to distribute and install
8dist_man_MANS =
9if HAVE_MAGICK
10dist_man_MANS += doc/man/zbarimg.1
11endif
12if HAVE_VIDEO
13dist_man_MANS += doc/man/zbarcam.1
14endif
15
16# witness to man page build (many-to-many workaround)
17man_stamp = doc/man/man.stamp
18
19# TBD add manual content
20#dist_doc_DATA = doc/zbar.pdf doc/zbar.html
21
22# distribute all documentation related files to avoid end-user rebuilds
23EXTRA_DIST += $(DOCSOURCES) $(man_stamp)
24EXTRA_DIST += doc/api/footer.html doc/style.xsl
25
26docs: $(dist_man_MANS) #dist_doc_DATA
27
28PHONY += docs
29
30doc_path = --searchpath $(abs_builddir)/doc -m $(abs_srcdir)/doc/style.xsl
31# xmlto --searchpath broken again...
32doc_path += --skip-validation
33
34#pdf: doc/zbar-manual.pdf
35#doc/zbar-manual.pdf: $(DOCSOURCES)
36#	$(XMLTO) $(XMLTOFLAGS) -o doc pdf $<
37
38html-local: doc/html/index.html
39doc/html/index.html: $(DOCSOURCES)
40	$(XMLTO) $(doc_path) $(XMLTOFLAGS) -o doc/html xhtml $<
41
42CLEANFILES += doc/html/*.html
43
44$(dist_man_MANS): $(man_stamp)
45	@if test ! -f $@ ; then \
46	  rm -f $(man_stamp) ; \
47	  $(MAKE) $(AM_MAKEFLAGS) $(man_stamp) ; \
48	fi
49
50$(man_stamp): $(DOCSOURCES)
51	@$(mkdir_p) doc/man 2>/dev/null
52	@rm -f $(man_stamp).tmp
53	@touch $(man_stamp).tmp
54	$(XMLTO) $(doc_path) $(XMLTOFLAGS) -o doc/man man $<
55	@mv $(man_stamp).tmp $(man_stamp)
56