1# German and English online docs: 2# make all 3# make install prefix=/path/to/webspace 4# The offline docs: 5# make chm HHC=/path/to/hhc.exe 6 7# Only English online docs, which can be partially updated: 8# make online-en 9# The English offline doc: 10# make chm/en/Developer.chm HHC=/path/to/hhc.exe 11# XML syntax check: 12# make check 13 14# Extra Parameters for xsltproc can be given in the XSLTFLAGS variable. 15# Use prefix to select the directory where the docs are to be installed 16 17prefix = /tmp 18HHC = hhc.exe 19MKDIR_P = mkdir -p 20CP = cp 21CP_R = cp -r 22 23stylesheet = clonk.xsl 24 25# Sources: 26 27# find all directories neither beginning nor contained within a directory beginning with a dot 28sdk-dirs := $(shell find sdk -name '.*' -prune -o -type d -print) 29 30# find all *.xml files recursively in sdk/ 31xmlfiles := $(sort $(shell find sdk -name '.*' -prune -o -name 'content.xml' -prune -o -name \*.xml -print)) 32 33# misc 34extra-files := $(sort $(wildcard *.css *.php *.js images/*.*)) 35extra-files-chm := $(sort $(wildcard *.css *.js images/*.*)) 36 37# Targets: 38 39# strip from all files the .xml, and add a .html 40htmlfiles := $(addsuffix .html, $(basename $(xmlfiles))) 41 42# The translated files and directories 43sdk-de-dirs := $(subst sdk, sdk-de, $(sdk-dirs)) 44 45# For openclonk.org 46online-dirs := $(foreach lang, en de, $(addprefix online/$(lang)/, $(sdk-dirs) images)) 47online-sdk-files := $(foreach lang, en de, $(addprefix online/$(lang)/, $(htmlfiles) sdk/content.html)) 48online-extra-files := $(foreach lang, en de, $(addprefix online/$(lang)/, $(extra-files))) 49 50# For Entwickler.chm 51chm-dirs := $(foreach lang, en de, $(addprefix chm/$(lang)/, . $(sdk-dirs) images)) 52 53.PHONY: all online-en chm install check clean 54 55all: $(sdk-de-dirs) $(online-dirs) $(online-sdk-files) $(online-extra-files) 56 57online-en: $(addprefix online/en/, $(sdk-dirs) images $(htmlfiles) sdk/content.html $(extra-files)) 58 59chm: $(sdk-de-dirs) $(chm-dirs) chm/en/Developer.chm chm/de/Entwickler.chm 60 61install: all 62 $(MKDIR_P) $(prefix) 63 $(CP_R) online/* $(prefix) 64 65check: 66 @xmllint --noblanks --noout --valid $(xmlfiles) 67 68clean: 69 rm -f *.mo Entwickler.chm Developer.chm doku.pot sdk/content.xml 70 rm -rf online sdk-de chm 71 72sdk/content.xml: sdk/content.xml.in $(xmlfiles) build_contents.py experimental.py 73 @echo generate $@ 74 @python2 build_contents.py $(xmlfiles) 75 76chm/en/Output.hhp: $(xmlfiles) chm/en/. build_hhp.py Template.hhp 77 @echo generate $@ 78 @python2 build_hhp.py $@ Template.hhp $(xmlfiles) 79chm/de/Output.hhp: $(xmlfiles) chm/de/. build_hhp.py Template.de.hhp 80 @echo generate $@ 81 @python2 build_hhp.py $@ Template.de.hhp $(xmlfiles) 82 83$(sdk-de-dirs) $(online-dirs) $(chm-dirs): 84 mkdir -p $@ 85 86doku.pot: $(xmlfiles) extra-strings.xml sdk/content.xml.in xml2po.py clonk.py 87 @echo extract strings to $@ 88 @python2 xml2po.py -e -m clonk -o $@ $(xmlfiles) extra-strings.xml sdk/content.xml.in 89 90%.po: doku.pot 91 @echo update $@ 92# @msgmerge --no-wrap -w 1 -U $@ $< 93 @msgmerge --no-wrap -w 1 -o $@ $@ $< 94 95%.mo: %.po 96 @echo compile $@ 97 @msgfmt --statistics -o $@ $< 98 99sdk-de/%.xml: sdk/%.xml de.mo xml2po.py clonk.py 100 @echo generate $@ 101 @python2 xml2po.py -e -m clonk -t de.mo -o $@ $< 102 103define run-xslt 104@echo generate $@ 105@xsltproc -o $@ --param chm $(chm) --param fileext "'.html'" $(XSLTFLAGS) $(stylesheet) $< 106endef 107online/%: chm=0 108chm/%: chm=1 109online/en/sdk/%.html: sdk/%.xml $(stylesheet) ; $(run-xslt) 110online/de/sdk/%.html: sdk-de/%.xml $(stylesheet) ; $(run-xslt) 111chm/en/sdk/%.html: sdk/%.xml $(stylesheet) ; $(run-xslt) 112chm/de/sdk/%.html: sdk-de/%.xml $(stylesheet) ; $(run-xslt) 113chm/en/Output.hhc: stylesheet=hhc.xsl 114chm/de/Output.hhc: stylesheet=hhc.xsl 115chm/en/Output.hhc: sdk/content.xml hhc.xsl ; $(run-xslt) 116chm/de/Output.hhc: sdk-de/content.xml hhc.xsl ; $(run-xslt) 117chm/en/Output.hhk: stylesheet=hhk.xsl 118chm/de/Output.hhk: stylesheet=hhk.xsl 119chm/en/Output.hhk: sdk/content.xml hhk.xsl ; $(run-xslt) 120chm/de/Output.hhk: sdk-de/content.xml hhk.xsl ; $(run-xslt) 121 122$(filter online/en/%, $(online-extra-files)): online/en/%: % 123 $(CP) $< $@ 124$(filter online/de/%, $(online-extra-files)): online/de/%: % 125 $(CP) $< $@ 126$(addprefix chm/en/, $(extra-files-chm)): chm/en/%: % 127 $(CP) $< $@ 128$(addprefix chm/de/, $(extra-files-chm)): chm/de/%: % 129 $(CP) $< $@ 130 131chm/en/Developer.chm: chm/en/Output.hhp chm/en/Output.hhk chm/en/Output.hhc $(addprefix chm/en/, $(sdk-dirs) images $(htmlfiles) $(extra-files-chm)) 132 ! "$(HHC)" $< 133chm/de/Entwickler.chm: chm/de/Output.hhp chm/de/Output.hhk chm/de/Output.hhc $(addprefix chm/de/, $(sdk-dirs) images $(htmlfiles) $(extra-files-chm)) 134 ! "$(HHC)" $< 135 136