File: Makefile

package info (click to toggle)
hydrogen 1.2.2%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 83,860 kB
  • sloc: xml: 75,490; cpp: 75,443; sh: 871; python: 238; ruby: 219; makefile: 158; javascript: 130; php: 90; ansic: 26
file content (89 lines) | stat: -rw-r--r-- 2,622 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
###
### must have the following commandline tools:
###
### itstool  (Debian package: itstool)
### msgfmt   (Debian package: gettext)
### msgmerge (Debian package: gettext)	
### xmlto    (Debian package: xmlto)
### xmllint  (Debian package: libxml2-utils)
###

MANUAL_MASTER = manual.docbook
TUTORIAL_MASTER = tutorial.docbook

XMLTO_OPTS = --stringparam section.autolabel=1 \
	--stringparam use.is.as.filename=1 \
	--stringparam toc.max.depth=3 \
	--stringparam xref.with.number.and.title=0 \
	--stringparam section.label.includes.component.label=1 \
	--stringparam admon.graphics.extension=.svg \
	--stringparam admon.graphics=1 \
	--stringparam admon.style="'margin-left: 5%;'" \
	--stringparam ulink.target="_blank"

ITSTOOL = itstool
MSGMERGE = msgmerge
MSGFMT = msgfmt
XMLTO = xmlto
XMLLINT = xmllint

all: *.html clean

clean:
	-rm -f *.mo *_validated *.dbk *.bak

# Derive language from filename (and extension)
define LANGUAGE =
$$(echo -n $(1) | sed 's/.*_\(..\)\.$(2)/\1/')
endef

%.html: %.dbk %.dbk_validated
	sed -i "s%generated_en/%generated_$(call LANGUAGE,$<,dbk)/%g" $<
	LL=$(call LANGUAGE,$<,dbk) ; \
	$(XMLTO) html-nochunks $(XMLTO_OPTS) \
		--stringparam l10n.gentext.language=$$LL \
		--stringparam html.stylesheet='res/docbook.css' \
		--stringparam html.script='res/docbook.js' \
		--stringparam img.src.path=img/ \
		--stringparam admon.graphics.path=img/admonitions/ \
		-x res/xslt/html/docbook.xsl \
		$<
	LL=$(call LANGUAGE,$<,dbk) ; \
	$(XMLTO) html -o $*_chunked $(XMLTO_OPTS) \
		--stringparam l10n.gentext.language=$$LL \
		--stringparam html.stylesheet='../res/docbook.css' \
		--stringparam html.script='../res/docbook.js' \
		--stringparam img.src.path=../img/ \
		--stringparam admon.graphics.path=../img/admonitions/ \
		-x res/xslt/html/chunk.xsl \
		$<

%.dbk_validated: %.dbk
	$(XMLLINT) --noout --valid $^
	touch $@

## Special rule for master manual and tutorial
%_en.dbk: %.docbook
	cp -f $^ $@

manual_%.dbk: manual_%.mo manual_%.po $(MANUAL_MASTER)
	$(ITSTOOL) -m $< -o $@ --lang $* $(MANUAL_MASTER)

manual_%.po: $(MANUAL_MASTER)
	$(ITSTOOL) -o manual.pot $<
	$(MSGMERGE) -U $@ manual.pot --backup=simple --no-wrap --verbose

manual_%.mo: manual_%.po
	`cat $< | sed 's/, fuzzy//g' > $<.bak`
	$(MSGFMT) --check -o $@ $<.bak

tutorial_%.dbk: tutorial_%.mo tutorial_%.po $(TUTORIAL_MASTER)
	$(ITSTOOL) -m $< -o $@ --lang $* $(TUTORIAL_MASTER)

tutorial_%.po: $(TUTORIAL_MASTER)
	$(ITSTOOL) -o tutorial.pot $<
	$(MSGMERGE) -U $@ tutorial.pot --backup=simple --no-wrap --verbose

tutorial_%.mo: tutorial_%.po
	`cat $< | sed 's/, fuzzy//g' > $<.bak`
	$(MSGFMT) --check -o $@ $<.bak