2013-02-21 21:34:52 +00:00
|
|
|
# German and English online docs:
|
|
|
|
# make all
|
|
|
|
# make install prefix=/path/to/webspace
|
|
|
|
# The offline docs:
|
|
|
|
# make chm HHC=/path/to/hhc.exe
|
|
|
|
|
|
|
|
# Only English online docs, which can be partially updated:
|
|
|
|
# make online-en
|
|
|
|
# The English offline doc:
|
|
|
|
# make chm/en/Developer.chm HHC=/path/to/hhc.exe
|
|
|
|
# XML syntax check:
|
|
|
|
# make check
|
2009-05-09 13:11:51 +00:00
|
|
|
|
|
|
|
# Extra Parameters for xsltproc can be given in the XSLTFLAGS variable.
|
|
|
|
# Use prefix to select the directory where the docs are to be installed
|
|
|
|
|
|
|
|
prefix = /tmp
|
|
|
|
HHC = hhc.exe
|
|
|
|
MKDIR_P = mkdir -p
|
|
|
|
CP = cp
|
|
|
|
CP_R = cp -r
|
|
|
|
|
|
|
|
stylesheet = clonk.xsl
|
|
|
|
|
|
|
|
# Sources:
|
|
|
|
|
|
|
|
# find all directories neither beginning nor contained within a directory beginning with a dot
|
|
|
|
sdk-dirs := $(shell find sdk -name '.*' -prune -o -type d -print)
|
|
|
|
|
2012-05-05 20:48:27 +00:00
|
|
|
# find all *.xml files recursively in sdk/
|
|
|
|
xmlfiles := $(sort $(shell find sdk -name '.*' -prune -o -name 'content.xml' -prune -o -name \*.xml -print))
|
|
|
|
|
2009-05-09 13:11:51 +00:00
|
|
|
# misc
|
2011-06-29 23:43:01 +00:00
|
|
|
extra-files := $(sort $(wildcard *.css *.php *.js images/*.*))
|
2009-05-09 13:11:51 +00:00
|
|
|
extra-files-chm := $(sort $(wildcard *.css *.js images/*.*))
|
|
|
|
|
|
|
|
# Targets:
|
|
|
|
|
2010-02-09 23:55:32 +00:00
|
|
|
# strip from all files the .xml, and add a .html
|
|
|
|
htmlfiles := $(addsuffix .html, $(basename $(xmlfiles)))
|
2009-05-09 13:11:51 +00:00
|
|
|
|
|
|
|
# The translated files and directories
|
2010-08-22 13:13:17 +00:00
|
|
|
sdk-de-dirs := $(subst sdk, sdk-de, $(sdk-dirs))
|
2009-05-09 13:11:51 +00:00
|
|
|
|
2010-02-16 01:48:06 +00:00
|
|
|
# For openclonk.org
|
2009-05-09 13:11:51 +00:00
|
|
|
online-dirs := $(foreach lang, en de, $(addprefix online/$(lang)/, $(sdk-dirs) images))
|
2012-05-05 20:48:27 +00:00
|
|
|
online-sdk-files := $(foreach lang, en de, $(addprefix online/$(lang)/, $(htmlfiles) sdk/content.html))
|
2009-05-09 13:11:51 +00:00
|
|
|
online-extra-files := $(foreach lang, en de, $(addprefix online/$(lang)/, $(extra-files)))
|
|
|
|
|
|
|
|
# For Entwickler.chm
|
|
|
|
chm-dirs := $(foreach lang, en de, $(addprefix chm/$(lang)/, . $(sdk-dirs) images))
|
|
|
|
|
2010-08-22 13:13:17 +00:00
|
|
|
.PHONY: all online-en chm install check clean
|
2009-05-09 13:11:51 +00:00
|
|
|
|
2012-05-05 20:48:27 +00:00
|
|
|
all: $(sdk-de-dirs) $(online-dirs) $(online-sdk-files) $(online-extra-files)
|
2009-05-09 13:11:51 +00:00
|
|
|
|
2010-08-22 13:13:17 +00:00
|
|
|
online-en: $(addprefix online/en/, $(sdk-dirs) images $(htmlfiles) sdk/content.html $(extra-files))
|
2009-05-09 13:11:51 +00:00
|
|
|
|
2012-05-05 20:48:27 +00:00
|
|
|
chm: $(sdk-de-dirs) $(chm-dirs) chm/en/Developer.chm chm/de/Entwickler.chm
|
2009-05-09 13:11:51 +00:00
|
|
|
|
|
|
|
install: all
|
|
|
|
$(MKDIR_P) $(prefix)
|
2012-11-18 21:01:07 +00:00
|
|
|
$(CP_R) online/* $(prefix)
|
2009-05-09 13:11:51 +00:00
|
|
|
|
|
|
|
check:
|
2013-02-24 13:45:46 +00:00
|
|
|
@xmllint --noblanks --noout --valid $(xmlfiles)
|
2009-05-09 13:11:51 +00:00
|
|
|
|
|
|
|
clean:
|
2012-05-05 20:48:27 +00:00
|
|
|
rm -f *.mo Entwickler.chm Developer.chm doku.pot sdk/content.xml
|
2010-08-22 13:13:17 +00:00
|
|
|
rm -rf online sdk-de chm
|
2009-05-09 13:11:51 +00:00
|
|
|
|
2011-09-19 12:50:27 +00:00
|
|
|
sdk/content.xml: sdk/content.xml.in $(xmlfiles) build_contents.py experimental.py
|
|
|
|
@echo generate $@
|
2016-02-14 21:32:29 +00:00
|
|
|
@python2 build_contents.py $(xmlfiles)
|
2011-09-19 12:50:27 +00:00
|
|
|
|
|
|
|
chm/en/Output.hhp: $(xmlfiles) chm/en/. build_hhp.py Template.hhp
|
|
|
|
@echo generate $@
|
2016-02-14 21:32:29 +00:00
|
|
|
@python2 build_hhp.py $@ Template.hhp $(xmlfiles)
|
2011-09-19 12:50:27 +00:00
|
|
|
chm/de/Output.hhp: $(xmlfiles) chm/de/. build_hhp.py Template.de.hhp
|
|
|
|
@echo generate $@
|
2016-02-14 21:32:29 +00:00
|
|
|
@python2 build_hhp.py $@ Template.de.hhp $(xmlfiles)
|
2009-05-09 13:11:51 +00:00
|
|
|
|
2010-08-22 13:13:17 +00:00
|
|
|
$(sdk-de-dirs) $(online-dirs) $(chm-dirs):
|
2009-05-09 13:11:51 +00:00
|
|
|
mkdir -p $@
|
|
|
|
|
2010-08-22 13:13:17 +00:00
|
|
|
doku.pot: $(xmlfiles) extra-strings.xml sdk/content.xml.in xml2po.py clonk.py
|
2009-05-09 13:11:51 +00:00
|
|
|
@echo extract strings to $@
|
2016-02-14 21:32:29 +00:00
|
|
|
@python2 xml2po.py -e -m clonk -o $@ $(xmlfiles) extra-strings.xml sdk/content.xml.in
|
2009-05-09 13:11:51 +00:00
|
|
|
|
|
|
|
%.po: doku.pot
|
|
|
|
@echo update $@
|
2011-09-19 12:50:27 +00:00
|
|
|
# @msgmerge --no-wrap -w 1 -U $@ $<
|
2011-09-07 14:05:05 +00:00
|
|
|
@msgmerge --no-wrap -w 1 -o $@ $@ $<
|
2009-05-09 13:11:51 +00:00
|
|
|
|
|
|
|
%.mo: %.po
|
|
|
|
@echo compile $@
|
|
|
|
@msgfmt --statistics -o $@ $<
|
|
|
|
|
2010-08-22 13:13:17 +00:00
|
|
|
sdk-de/%.xml: sdk/%.xml de.mo xml2po.py clonk.py
|
2009-05-09 13:11:51 +00:00
|
|
|
@echo generate $@
|
2016-02-14 21:32:29 +00:00
|
|
|
@python2 xml2po.py -e -m clonk -t de.mo -o $@ $<
|
2009-05-09 13:11:51 +00:00
|
|
|
|
|
|
|
define run-xslt
|
|
|
|
@echo generate $@
|
2011-09-09 19:36:03 +00:00
|
|
|
@xsltproc -o $@ --param chm $(chm) --param fileext "'.html'" $(XSLTFLAGS) $(stylesheet) $<
|
2009-05-09 13:11:51 +00:00
|
|
|
endef
|
2011-09-09 19:36:03 +00:00
|
|
|
online/%: chm=0
|
|
|
|
chm/%: chm=1
|
2010-08-22 13:13:17 +00:00
|
|
|
online/en/sdk/%.html: sdk/%.xml $(stylesheet) ; $(run-xslt)
|
|
|
|
online/de/sdk/%.html: sdk-de/%.xml $(stylesheet) ; $(run-xslt)
|
|
|
|
chm/en/sdk/%.html: sdk/%.xml $(stylesheet) ; $(run-xslt)
|
|
|
|
chm/de/sdk/%.html: sdk-de/%.xml $(stylesheet) ; $(run-xslt)
|
2010-02-15 12:25:33 +00:00
|
|
|
chm/en/Output.hhc: stylesheet=hhc.xsl
|
2010-08-22 13:13:17 +00:00
|
|
|
chm/de/Output.hhc: stylesheet=hhc.xsl
|
|
|
|
chm/en/Output.hhc: sdk/content.xml hhc.xsl ; $(run-xslt)
|
|
|
|
chm/de/Output.hhc: sdk-de/content.xml hhc.xsl ; $(run-xslt)
|
2011-09-19 12:50:27 +00:00
|
|
|
chm/en/Output.hhk: stylesheet=hhk.xsl
|
|
|
|
chm/de/Output.hhk: stylesheet=hhk.xsl
|
|
|
|
chm/en/Output.hhk: sdk/content.xml hhk.xsl ; $(run-xslt)
|
|
|
|
chm/de/Output.hhk: sdk-de/content.xml hhk.xsl ; $(run-xslt)
|
2009-05-09 13:11:51 +00:00
|
|
|
|
|
|
|
$(filter online/en/%, $(online-extra-files)): online/en/%: %
|
|
|
|
$(CP) $< $@
|
|
|
|
$(filter online/de/%, $(online-extra-files)): online/de/%: %
|
|
|
|
$(CP) $< $@
|
|
|
|
$(addprefix chm/en/, $(extra-files-chm)): chm/en/%: %
|
|
|
|
$(CP) $< $@
|
|
|
|
$(addprefix chm/de/, $(extra-files-chm)): chm/de/%: %
|
|
|
|
$(CP) $< $@
|
|
|
|
|
2010-02-15 12:25:33 +00:00
|
|
|
chm/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))
|
2013-02-23 20:52:05 +00:00
|
|
|
! "$(HHC)" $<
|
2010-08-22 13:13:17 +00:00
|
|
|
chm/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))
|
2013-02-23 20:52:05 +00:00
|
|
|
! "$(HHC)" $<
|
2011-09-09 19:36:03 +00:00
|
|
|
|