Debian Codegraph @

doc/Makefile

raw symbols ◀ ▶ SCIP
1 Debian patch touch this file
1 #
2 # Copyright (C) 2008-2025 Alexis Bienvenüe <[email protected]>
3 #
4 # This file is part of Auto-Multiple-Choice
5 #
6 # Auto-Multiple-Choice is free software: you can redistribute it
7 # and/or modify it under the terms of the GNU General Public License
8 # as published by the Free Software Foundation, either version 2 of
9 # the License, or (at your option) any later version.
10 #
11 # Auto-Multiple-Choice is distributed in the hope that it will be
12 # useful, but WITHOUT ANY WARRANTY; without even the implied warranty
13 # of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 # General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with Auto-Multiple-Choice. If not, see
18 # <http://www.gnu.org/licenses/>.
19
20 SHELL=/bin/sh
21
22 include ../Makefile-all.conf
23
24 ALL_DOCBOOKS = $(filter-out $(wildcard *.in.xml),$(wildcard auto-multiple-choice.*.xml))
25 DOC_LANG ?= $(patsubst auto-multiple-choice.%.xml,%,$(ALL_DOCBOOKS))
26 SELECTED_DOCBOOKS = $(foreach onelang,$(DOC_LANG),auto-multiple-choice.$(onelang).xml)
27
28 IMAGES=$(addprefix html/images/,$(notdir $(wildcard img_src/*.svg))) $(addprefix html/images/callouts/,$(notdir $(wildcard img_src/callouts/*.svg)))
29 BLOCK_IMAGES=$(addprefix img_pdf/,$(notdir $(wildcard img_src/*.svg)))
30
31 MODELS=$(wildcard modeles/*/*.d)
32
33 all: $(SELECTED_DOCBOOKS:.xml=.pdf) $(SELECTED_DOCBOOKS:.xml=.x) $(IMAGES:.svg=.png) $(MODELS:.d=.tgz) html/index.html;
34
35 show_doc_lang:
36 @echo "DOC_LANG = $(DOC_LANG)"
37
38 images: $(IMAGES:.svg=.png)
39
40 clean:
41 rm -f $(foreach ext,1 aux cb cb2 glo idx log out toc tex html pdf ext man,*.$(ext))
42 rm -f modeles/*.tgz
43 rm -f modeles/**/*.tgz
44 rm -f html/auto-multiple-choice.**/*.html
45 rm -f html/images/callouts/*.png html/images/*.png img_pdf/*.pdf
46 rm -f *~
47
48 html/images/callouts/%.png: img_src/callouts/%.svg
49 rsvg-convert -w 12 -h 12 $< -o $@
50
51 html/images/%.png: img_src/%.svg
52 rsvg-convert -w 24 -h 24 $< -o $@
53
54 img_pdf/%.pdf: img_src/%.svg
55 rsvg-convert -f pdf $< -o $@
56
57 html/index.html: FORCE
58 $(PERLPATH) ./index.pl $(SELECTED_DOCBOOKS:.xml=) > $@
59
60 %.tex: %.xml amcdocstyle.sty
61 dblatex -P latex.encoding=utf8 -b xetex -t tex -p custom.xsl --texstyle=amcdocstyle --xslt-opts="--nonet" --xslt-opts="--catalogs" $(DBLATEX_OPT) $< -o $@
62 # dblatex bug workaround (python3 writes b'<:' instead of <:)
63 perl -pi -e "s,b'<:',<:,g ; s,b':>',:>,g " $@
•64 # setupbabel bug workaround
65 perl -pi -e "s,^.setupbabel,% *setupbabel," $@
66
67 XELATEX=xelatex -halt-on-error -interaction=nonstopmode
68
69 %.pdf: export SOURCE_DATE_EPOCH=$(PACKAGE_V_EPOCH)
70 %.pdf: export SOURCE_DATE_EPOCH_TEX_PRIMITIVES=1
71 %.pdf: export FORCE_SOURCE_DATE=1
72 %.pdf: export TEXINPUTS=./img_pdf/:
73
74 %.pdf: %.tex $(BLOCK_IMAGES:.svg=.pdf)
75 set -e ; $(XELATEX) $<; $(XELATEX) $<
76 rm -f $(foreach ext,aux cb cb2 glo idx log out toc,$*.$(ext))
77
78 %.x: %.ext %.man %.html ;
79
80 %.ext: %.xml
81 $(PERLPATH) extrait-fichiers.pl --liste $@ $<
82
83 %.man: %.xml
84 xsltproc --nonet --catalogs --param man.charmap.use.subset "0" --param make.year.ranges "1" --param make.single.year.ranges "1" --param man.output.lang.in.name.enabled "1" $(DOCBOOK_MAN_XSL) $<
85 date > $@
86
87 %.html: %.xml doc-xhtml.xsl
88 rm -f html/$*/*.html
89 xsltproc --nonet --catalogs --stringparam base.dir html/$*/ doc-xhtml.xsl $<
90 date > $@
91
92 %.tgz: %.d
93 find $< -type d -exec chmod 0755 '{}' \;
94 find $< -type f -exec chmod 0644 '{}' \;
95 ifeq ($(TAR_REPRODUCIBLE_ARGS),nonreproducible)
96 tar -cz -f $@ -C $< .
97 else
98 tar cn -C $< $(TAR_REPRODUCIBLE_ARGS) -O . | gzip $(GZIP_REPRODUCIBLE_ARGS) -c > $@
99 endif
100
101 check: FORCE
102 ./check_xml
103
104 FORCE: ;
105
106 .PHONY: FORCE all images clean check