chiark / gitweb /
_make-more-docs
[sgt-puzzles.git] / Makefile.doc
index 53e955732a91bed8c970e4489829bf11b13068bd..00436a56ab6b3f4ef60ecee7a233182541e2d8a3 100644 (file)
@@ -14,12 +14,20 @@ puzzles.hhp: puzzles.but chm.but
        halibut --html puzzles.but chm.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
@@ -44,6 +52,38 @@ 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