File: Makefile.doc

package info (click to toggle)
sgt-puzzles 20170606.272beef-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 11,584 kB
  • ctags: 8,513
  • sloc: ansic: 108,424; perl: 1,936; objc: 1,304; sh: 1,256; makefile: 166
file content (89 lines) | stat: -rw-r--r-- 2,645 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
all: puzzles.chm puzzles.hlp puzzles.txt HACKING

preprocessed.but: puzzles.but
	sed 's/PREFIX-/$(BINPREFIX)/g' puzzles.but > preprocessed.but

puzzles.chm: preprocessed.but
	halibut --chm=puzzles.chm preprocessed.but
puzzles.hlp: preprocessed.but
	halibut --winhelp=puzzles.hlp preprocessed.but
puzzles.txt: preprocessed.but
	halibut --text=puzzles.txt preprocessed.but

HACKING: devel.but
	halibut --text=HACKING devel.but

TRANSLATIONS := $(patsubst po/%.po,%,$(wildcard po/*.po))
LANGUAGES := en $(TRANSLATIONS)

update-po:
# Please tell me there is an easier way to preserve the POT file header.
	test -f po/puzzles-doc.pot
	po4a-gettextize -f halibut -m puzzles.but --package-name puzzles \
		-p po/puzzles-doc.tmp1.pot
	awk -F: '{ print ""; \
		   print "#: " $$1 ".R"; \
		   print "msgid \"" $$4 "\""; \
		   print "msgstr \"\""; }' \
		< gamedesc.txt >> po/puzzles-doc.tmp1.pot
	xgettext -j -cTranslator: --package-name puzzles \
		-o po/puzzles-doc.tmp1.pot mkmanpages.pl
	sed -i '1,/^#$$/d' po/puzzles-doc.tmp1.pot
	cat po/puzzles-doc.pot.head po/puzzles-doc.tmp1.pot \
		> po/puzzles-doc.tmp2.pot
	diff -q -I Project-Id-Version: -I POT-Creation-Date: \
		po/puzzles-doc.pot po/puzzles-doc.tmp2.pot || \
		mv po/puzzles-doc.tmp2.pot po/puzzles-doc.pot
	rm -f po/puzzles-doc.tmp*.pot
	for lang in $(TRANSLATIONS); do \
		msgmerge --previous -U po/$$lang.po po/puzzles-doc.pot || exit; \
	done
.PHONY: update-po

doc/puzzles.but.%: puzzles.but po/%.po
	mkdir -p doc
	po4a-translate -k 0 -f halibut -m puzzles.but -p po/$*.po -l $@
.PRECIOUS: $(addprefix doc/puzzles.but.,$(TRANSLATIONS))

doc/preprocessed.but.%: doc/puzzles.but.%
	sed 's/PREFIX-/$(BINPREFIX)/g' $< > $@

doc/puzzles.txt.%: doc/preprocessed.but.%
	halibut --text=$@ --input-charset=UTF-8 $<
all: $(addprefix doc/puzzles.txt.,$(TRANSLATIONS))

doc/man-en-stamp: preprocessed.but
	mkdir -p doc
	rm -rf doc/man-en
	mkdir doc/man-en
	perl mkmanpages.pl en
	touch $@
doc/man-%-stamp: doc/preprocessed.but.%
	mkdir -p doc
	rm -rf doc/man-$*
	mkdir doc/man-$*
	perl mkmanpages.pl $*
	touch $@
man: $(patsubst %,doc/man-%-stamp,$(LANGUAGES))

doc/html-en-stamp: preprocessed.but
	mkdir -p doc
	rm -rf doc/html-en
	mkdir doc/html-en
	cd doc/html-en && halibut --html ../../preprocessed.but
	touch $@
doc/html-%-stamp: doc/preprocessed.but.%
	mkdir -p doc
	rm -rf doc/html-$*
	mkdir doc/html-$*
	cd doc/html-$* && halibut --html --input-charset=UTF-8 ../preprocessed.but.$*
	touch $@
html: $(patsubst %,doc/html-%-stamp,$(LANGUAGES))

.PHONY: man html
all: man html

clean:
	rm -f puzzles.hlp puzzles.txt preprocessed.but HACKING *.html *.hh[pck]
	rm -f puzzles.cnt
	rm -rf doc