File: Makefile

package info (click to toggle)
auto-multiple-choice 1.7.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 92,612 kB
  • sloc: perl: 26,752; xml: 24,889; cpp: 1,997; python: 895; makefile: 569; sh: 233; ansic: 195
file content (104 lines) | stat: -rw-r--r-- 3,522 bytes parent folder | download
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
#
# Copyright (C) 2008-2025 Alexis Bienvenüe <paamc@passoire.fr>
#
# This file is part of Auto-Multiple-Choice
#
# Auto-Multiple-Choice is free software: you can redistribute it
# and/or modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation, either version 2 of
# the License, or (at your option) any later version.
#
# Auto-Multiple-Choice is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Auto-Multiple-Choice.  If not, see
# <http://www.gnu.org/licenses/>.

SHELL=/bin/sh

include ../Makefile-all.conf

ALL_DOCBOOKS = $(filter-out $(wildcard *.in.xml),$(wildcard auto-multiple-choice.*.xml))
DOC_LANG ?= $(patsubst auto-multiple-choice.%.xml,%,$(ALL_DOCBOOKS))
SELECTED_DOCBOOKS = $(foreach onelang,$(DOC_LANG),auto-multiple-choice.$(onelang).xml)

IMAGES=$(addprefix html/images/,$(notdir $(wildcard img_src/*.svg))) $(addprefix html/images/callouts/,$(notdir $(wildcard img_src/callouts/*.svg)))
BLOCK_IMAGES=$(addprefix img_pdf/,$(notdir $(wildcard img_src/*.svg)))

MODELS=$(wildcard modeles/*/*.d)

all: $(SELECTED_DOCBOOKS:.xml=.pdf) $(SELECTED_DOCBOOKS:.xml=.x) $(IMAGES:.svg=.png) $(MODELS:.d=.tgz) html/index.html;

show_doc_lang:
	@echo "DOC_LANG = $(DOC_LANG)"

images: $(IMAGES:.svg=.png)

clean:
	rm -f $(foreach ext,1 aux cb cb2 glo idx log out toc tex html pdf ext man,*.$(ext))
	rm -f modeles/*.tgz
	rm -f modeles/**/*.tgz
	rm -f html/auto-multiple-choice.**/*.html
	rm -f html/images/callouts/*.png html/images/*.png img_pdf/*.pdf
	rm -f *~

html/images/callouts/%.png: img_src/callouts/%.svg
	rsvg-convert -w 12 -h 12 $< -o $@

html/images/%.png: img_src/%.svg
	rsvg-convert -w 24 -h 24 $< -o $@

img_pdf/%.pdf: img_src/%.svg
	rsvg-convert -f pdf $< -o $@

html/index.html: FORCE
	$(PERLPATH) ./index.pl $(SELECTED_DOCBOOKS:.xml=) > $@

%.tex: %.xml amcdocstyle.sty
	dblatex -P latex.encoding=utf8 -b xetex -t tex -p custom.xsl --texstyle=amcdocstyle --xslt-opts="--nonet" --xslt-opts="--catalogs" $(DBLATEX_OPT) $< -o $@
# dblatex bug workaround (python3 writes b'<:' instead of <:)
	perl -pi -e "s,b'<:',<:,g ; s,b':>',:>,g " $@

XELATEX=xelatex -halt-on-error -interaction=nonstopmode

%.pdf: export SOURCE_DATE_EPOCH=$(PACKAGE_V_EPOCH)
%.pdf: export SOURCE_DATE_EPOCH_TEX_PRIMITIVES=1
%.pdf: export FORCE_SOURCE_DATE=1
%.pdf: export TEXINPUTS=./img_pdf/:

%.pdf: %.tex $(BLOCK_IMAGES:.svg=.pdf)
	set -e ; $(XELATEX) $<; $(XELATEX) $<
	rm -f $(foreach ext,aux cb cb2 glo idx log out toc,$*.$(ext))

%.x: %.ext %.man %.html ;

%.ext: %.xml
	$(PERLPATH) extrait-fichiers.pl --liste $@ $<

%.man: %.xml
	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) $<
	date > $@

%.html: %.xml doc-xhtml.xsl
	rm -f html/$*/*.html
	xsltproc --nonet --catalogs --stringparam base.dir html/$*/ doc-xhtml.xsl $<
	date > $@

%.tgz: %.d
	find $< -type d -exec chmod 0755 '{}' \;
	find $< -type f -exec chmod 0644 '{}' \;
ifeq ($(TAR_REPRODUCIBLE_ARGS),nonreproducible)
	tar -cz -f $@ -C $< .
else
	tar cn -C $< $(TAR_REPRODUCIBLE_ARGS) -O . | gzip $(GZIP_REPRODUCIBLE_ARGS) -c > $@
endif

check: FORCE
	./check_xml

FORCE: ;

.PHONY: FORCE all images clean check