Debian Codegraph @

microhope/microhope-doc/Makefile

raw
1 DESTDIR =
2 SOURCES = $(wildcard *.lyx)
3 PDFS = $(patsubst %.lyx, %.pdf, $(SOURCES))
4 TEXS = $(patsubst %.lyx, %.tex, $(SOURCES))
5 WARNING = LaTeX Warning: Label(s) may have changed. Rerun
6 DOCDIR = $(DESTDIR)/usr/share/microhope/doc
7
8 DB2MAN = /usr/share/sgml/docbook/stylesheet/xsl/docbook-xsl/manpages/docbook.xsl
9 XP = xsltproc --nonet --param man.charmap.use.subset "0"
10
11 all:
12
13 touch-existing-pdf:
14 for f in $$(ls *.pdf); do touch $$f; done
15
16 manpages: ../create-microhope-env.1 ../microhope.1 microhope-doc.1 ../uhope.1
17
18 ../create-microhope-env.1: ../create-microhope-env.xml
19 cd ..; $(XP) $(DB2MAN) create-microhope-env.xml
20
21 ../microhope.1: ../microhope.xml
22 cd ..; $(XP) $(DB2MAN) microhope.xml
23
24 ../uhope.1: ../uhope.xml
25 cd ..; $(XP) $(DB2MAN) uhope.xml
26
27 microhope-doc.1: microhope-doc.xml
28 $(XP) $(DB2MAN) $<
29
30 microhope-en.pdf: $(PDFS)
31 cp microhope.pdf $@
32
33 install: all
34 mkdir -p $(DOCDIR)
35 install -m 644 microhope-en.pdf $(DOCDIR)/
36
37 %.pdf: %.lyx
38 @echo -n "Exporting $< to a LaTeX file ... "
39 @lyx -e latex -userdir . $< >/dev/null 2>&1
40 @echo Done.
41 @echo -n "Running PDFLaTeX"
42 @ok=0; lyxfile=$<; \
43 logfile=$$(echo $${lyxfile} | sed 's/\.lyx/.log/'); \
44 texfile=$$(echo $${lyxfile} | sed 's/\.lyx/.tex/'); \
45 while [ $$ok = 0 ]; do \
46 echo -n " ... "; \
47 pdflatex -interaction=nonstopmode $${texfile} >/dev/null 2>&1 || true; \
48 if ! grep -q "$(WARNING)" $${logfile}; then \
49 ok=1; \
50 fi; \
51 done
52 @echo Done.
53
54 clean:
55 [ -f ../../keep-expeyes-tex ] || rm -f *.tex
56 rm -rf *~ *.aux *.log *.toc *.lof *.lst cache lyxrc.*
57
58 distclean: clean
59 [ -e ../../keep-expeyes-docs ] || rm -f $(PDFS) microhope-*.pdf
60 rm -f pics/*.eps
61
62 .PHONY: clean distclean all manpages install touch-existing-pdf