chiark / gitweb /
remove -pedantic
[sgt-puzzles.git] / Makefile.doc
1 all: puzzles.chm puzzles.hlp puzzles.txt HACKING
2
3 preprocessed.but: puzzles.but
4         sed 's/PREFIX-/$(BINPREFIX)/g' puzzles.but > preprocessed.but
5
6 puzzles.chm: preprocessed.but
7         halibut --chm=puzzles.chm preprocessed.but
8 puzzles.hlp: preprocessed.but
9         halibut --winhelp=puzzles.hlp preprocessed.but
10 puzzles.txt: preprocessed.but
11         halibut --text=puzzles.txt preprocessed.but
12
13 HACKING: devel.but
14         halibut --text=HACKING devel.but
15
16 chm: puzzles.hhp
17 puzzles.hhp: puzzles.but chm.but
18         halibut --html puzzles.but chm.but
19
20 TRANSLATIONS := $(patsubst po/%.po,%,$(wildcard po/*.po))
21 LANGUAGES := en $(TRANSLATIONS)
22
23 update-po:
24 # Please tell me there is an easier way to preserve the POT file header.
25         test -f po/puzzles-doc.pot
26         po4a-gettextize -f halibut -m puzzles.but --package-name puzzles \
27                 -p po/puzzles-doc.tmp1.pot
28         awk -F: '{ print ""; \
29                    print "#: " $$1 ".R"; \
30                    print "msgid \"" $$4 "\""; \
31                    print "msgstr \"\""; }' \
32                 < gamedesc.txt >> po/puzzles-doc.tmp1.pot
33         xgettext -j -cTranslator: --package-name puzzles \
34                 -o po/puzzles-doc.tmp1.pot mkmanpages.pl
35         sed -i '1,/^#$$/d' po/puzzles-doc.tmp1.pot
36         cat po/puzzles-doc.pot.head po/puzzles-doc.tmp1.pot \
37                 > po/puzzles-doc.tmp2.pot
38         diff -q -I Project-Id-Version: -I POT-Creation-Date: \
39                 po/puzzles-doc.pot po/puzzles-doc.tmp2.pot || \
40                 mv po/puzzles-doc.tmp2.pot po/puzzles-doc.pot
41         rm -f po/puzzles-doc.tmp*.pot
42         for lang in $(TRANSLATIONS); do \
43                 msgmerge --previous -U po/$$lang.po po/puzzles-doc.pot || exit; \
44         done
45 .PHONY: update-po
46
47 doc/puzzles.but.%: puzzles.but po/%.po
48         mkdir -p doc
49         po4a-translate -k 0 -f halibut -m puzzles.but -p po/$*.po -l $@
50 .PRECIOUS: $(addprefix doc/puzzles.but.,$(TRANSLATIONS))
51
52 doc/preprocessed.but.%: doc/puzzles.but.%
53         sed 's/PREFIX-/$(BINPREFIX)/g' $< > $@
54
55 doc/puzzles.txt.%: doc/preprocessed.but.%
56         halibut --text=$@ --input-charset=UTF-8 $<
57 all: $(addprefix doc/puzzles.txt.,$(TRANSLATIONS))
58
59 doc/man-en-stamp: preprocessed.but
60         mkdir -p doc
61         rm -rf doc/man-en
62         mkdir doc/man-en
63         perl mkmanpages.pl en
64         touch $@
65 doc/man-%-stamp: doc/preprocessed.but.%
66         mkdir -p doc
67         rm -rf doc/man-$*
68         mkdir doc/man-$*
69         perl mkmanpages.pl $*
70         touch $@
71 man: $(patsubst %,doc/man-%-stamp,$(LANGUAGES))
72
73 doc/html-en-stamp: preprocessed.but
74         mkdir -p doc
75         rm -rf doc/html-en
76         mkdir doc/html-en
77         cd doc/html-en && halibut --html ../../preprocessed.but
78         touch $@
79 doc/html-%-stamp: doc/preprocessed.but.%
80         mkdir -p doc
81         rm -rf doc/html-$*
82         mkdir doc/html-$*
83         cd doc/html-$* && halibut --html --input-charset=UTF-8 ../preprocessed.but.$*
84         touch $@
85 html: $(patsubst %,doc/html-%-stamp,$(LANGUAGES))
86
87 .PHONY: man html
88 all: man html
89
90 clean:
91         rm -f puzzles.hlp puzzles.txt preprocessed.but HACKING *.html *.hh[pck]
92         rm -f puzzles.cnt
93         rm -rf doc