summaryrefslogtreecommitdiff
path: root/dviware/dvisvgm/doc/Makefile.am
blob: dfdc0483b2134d46a0c1bf0cf9675f483f4a1e53 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
## This file is part of dvisvgm
## Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de>
##
## Process this file with automake.

# Don't try to install the manpage file if it can't be built due to missing utilities.
# However, the distribution tarball should always contain a recent manpage. We ensure
# this by adding a dist-hook rule below.

man_MANS = dvisvgm.1

EXTRA_DIST = $(man_MANS) \
	conf-dblatex-man.xsl \
	conf-dblatex-pdf.xsl \
	dvisvgm.txt.in \
	generate-dvisvgm-sty.xsl \
	tweak-dblatex-pdf.xsl \
	tweak-dblatex-tex.py \
	tweak-db-refentry.xsl

if BUILD_MANPAGE

CONF_DBLATEX_MAN  = $(dvisvgm_srcdir)/doc/conf-dblatex-man.xsl
CONF_DBLATEX_PDF  = $(dvisvgm_srcdir)/doc/conf-dblatex-pdf.xsl
TWEAK_DBLATEX_PDF = $(dvisvgm_srcdir)/doc/tweak-dblatex-pdf.xsl
TWEAK_DBLATEX_TEX = $(dvisvgm_srcdir)/doc/tweak-dblatex-tex.py
TWEAK_DB_ARTICLE  = $(dvisvgm_srcdir)/doc/tweak-db-article.xsl
TWEAK_DB_REFENTRY = $(dvisvgm_srcdir)/doc/tweak-db-refentry.xsl
GEN_DBLATEX_STY   = $(dvisvgm_srcdir)/doc/generate-dvisvgm-sty.xsl

DB_VARS = man.endnotes.list.enabled=0 man.endnotes.are.numbered=0 man.authors.section.enabled=0

dvisvgm.1: dvisvgm-man.xml $(CONF_DBLATEX_MAN)
	xmlto -m $(CONF_DBLATEX_MAN) $(addprefix --stringparam , $(DB_VARS)) man $<

dvisvgm.pdf: dvisvgm-man.xml dvisvgm.sty $(CONF_DBLATEX_PDF) $(TWEAK_DBLATEX_PDF) $(TWEAK_DBLATEX_TEX)
	mv $< $<.tmp
	xsltproc -o $< $(TWEAK_DBLATEX_PDF) $<.tmp
	dblatex -bxetex --texstyle=./dvisvgm.sty -p $(CONF_DBLATEX_PDF) -r plugin:$(basename $(TWEAK_DBLATEX_TEX)) $<
	mv $<.tmp $<
	mv $(basename $<).pdf $@

dvi-pdf: dvisvgm.dvi
	dvipdfm $<
	rm -f $<

dvisvgm.dvi: dvisvgm.1
	groff -Tdvi -mandoc ./$< >$@

dvisvgm.html: dvisvgm-man.xml db2html.xsl
	xsltproc -o $@ db2html.xsl $<

dvisvgm.md: dvisvgm-man.xml db2md.xsl
	xsltproc -o $@ db2md.xsl $<

dvisvgm.epub: dvisvgm-article.xml
	a2x -darticle -fepub -L --icons --icons-dir=. $<
	mv $(basename $<).epub $@

.SECONDARY: dvisvgm-article.xml dvisvgm-man.xml dvisvgm.sty

dvisvgm-man.xml: dvisvgm.txt $(TWEAK_DB_REFENTRY)
	asciidoc -a icons -a 'iconsdir=.' -a badges -a 'revnumber=@VERSION@' --unsafe -bdocbook -dmanpage -o $@.tmp $<
	xsltproc -o $@ $(TWEAK_DB_REFENTRY) $@.tmp
	rm $@.tmp

dvisvgm-article.xml: dvisvgm.txt $(TWEAK_DB_ARTICLE)
	asciidoc -a icons -a 'iconsdir=.' -a badges -a 'revnumber=@VERSION@' --unsafe -bdocbook -darticle -o $@.tmp $<
	xsltproc -o $@ $(TWEAK_DB_ARTICLE) $@.tmp
	rm $@.tmp
	sed -i "s/{VERSION}/@VERSION@/" $@

dvisvgm.sty: dvisvgm-man.xml $(GEN_DBLATEX_STY)
	xsltproc -o dvisvgm.sty $(GEN_DBLATEX_STY) $<

dvisvgm.txt: dvisvgm.txt.in ../configure.ac
	sed -e 's/@VERSION[@]/@VERSION@/g' -e 's/@PACKAGE_BUGREPORT[@]/@PACKAGE_BUGREPORT@/g' $< >$@
	if [ $< -nt ../configure.ac ]; \
	then touch -r $< $@; \
	else touch -r ../configure.ac $@; \
	fi

epub: dvisvgm.epub
html: dvisvgm.html
man: dvisvgm.1
md: dvisvgm.md
pdf: dvisvgm.pdf

endif

clean:
	rm -f dvisvgm.pdf dvisvgm.html dvisvgm.md dvisvgm-man.xml dvisvgm-article.xml dvisvgm.txt dvisvgm.sty dvisvgm.dvi dvisvgm.epub

distclean-local:
	rm -f dvisvgm.pdf dvisvgm.html dvisvgm.md dvisvgm-man.xml dvisvgm-article.xml dvisvgm.txt dvisvgm.sty dvisvgm.dvi dvisvgm.epub dvisvgm.1

if !BUILD_MANPAGE
# Ensure that distribution tarballs always contain a recent manpage, i.e.
# let "make dist" and "make distcheck" fail if dvisvgm.1 can't be built.
dist-hook:
	@echo "----------------------------------------------------------------"; \
	echo  "manpage file dvisvgm.1 could not be built because one or more of"; \
	echo  "the following utilities are missing: asciidoc, xmlto, xsltproc  "; \
	echo  "----------------------------------------------------------------"; \
	false;
endif