# Makefile, used for the developers-reference in DocBook XML # Note: This Makefile should work perfectly without the debian/ directory. SOURCES := $(wildcard *.dbk) common.ent version.ent FORMATS := html txt pdf LANGS := fr ja TARGETS := $(foreach fmt,$(FORMATS),developers-reference.$(fmt)) \ $(foreach lng,$(LANGS), \ $(foreach fmt,$(FORMATS), \ $(lng)/developers-reference.$(fmt))) # hopefully overwritten by caller, e.g. debian/rules VERSION=unknown PUBDATE=unknown # programs for creating output XP=xsltproc --nonet --novalid --xinclude XL=xmllint --nonet --noout --postvalid --xinclude # fop is currently in contrib, but can go to main, see #366783 # Alternatives: # - dblatex (0.2.6 has a minor problem with programlisting inside of # footnote, and a major one with lang="ja"); # - docbook2pdf (seems to die on UTF-8, #431085); and # - xmllint (not mature enough, waits in NEW, #182445) FOP=fop # The "--keep 0" should be removed as soon as the translations are ready TRANSLATE=po4a-translate --format docbook --keep 0 # XSL files and parameters # note: the URL is used as identifier, no HTTP is used! DOCBOOK_XSL=http://docbook.sourceforge.net/release/xsl/current # one file per chapter DBK2HTML=--stringparam chunk.section.depth 0 \ --stringparam section.autolabel 1 \ --stringparam use.id.as.filename 1 \ $(DOCBOOK_XSL)/xhtml/chunk.xsl # all in one file DBK2HTML1=--stringparam section.autolabel 1 \ $(DOCBOOK_XSL)/xhtml/docbook.xsl DBK2FO=$$TOP/fop.xsl # $(DOCBOOK_XSL)/fo/docbook.xsl .PHONY: all all: $(TARGETS) .PHONY: validate validate: $(SOURCES) $(XL) index.dbk %/validate: $(addprefix %/,$(SOURCES)) cd $(@D) && $(XL) index.dbk .PHONY: developers-reference.html %/developers-reference.html developers-reference.html: $(PWD)/index.html %/developers-reference.html: $(addprefix %/,index.html) @true .PRECIOUS: %/index.html index.html: $(PWD)/developers-reference.html %/index.html: $(addprefix %/,$(SOURCES)) cd $(@D) && $(XP) $(DBK2HTML) index.dbk # There must be an easier way than recursive make! .PRECIOUS: %.dbk %.ent ifndef LINGUA %.dbk %.ent: FORCE $(MAKE) $@ LINGUA=$(@D) FORCE: else $(LINGUA)/%.dbk: %.dbk $(patsubst %.dbk,po4a/$(LINGUA)/%.po,%.dbk) $(TRANSLATE) -m $< -p po4a/$(@:.dbk=.po) -l $@ $(LINGUA)/%.ent: %.ent cd $(@D) && ln -sf ../$(@F) . endif developers-reference.txt: $(PWD)/developers-reference.txt %/developers-reference.txt: $(addprefix %/,$(SOURCES)) $(XP) $(DBK2HTML1) $(@D)/index.dbk \ | w3m -cols 65 -dump -T text/html > $@ developers-reference.fo: $(PWD)/developers-reference.fo @true %/developers-reference.fo: $(addprefix %/,$(SOURCES)) fop.xsl TOP=`pwd` && cd $(@D) && $(XP) $(DBK2FO) index.dbk > $(@F) developers-reference.pdf: $(PWD)/developers-reference.pdf %/developers-reference.pdf: %/developers-reference.fo $(FOP) -fo $< -pdf $@ .PHONY: pot pot: $(patsubst %.dbk,po4a/po/%.pot,$(SOURCES)) po4a/po/%.pot: %.dbk po4a-gettextize --format docbook --master $< --po $@ ifdef LINGUA .PHONY: updatepo updatepo: $(patsubst %.dbk,po4a/$(LINGUA)/%.po,$(SOURCES)) po4a/$(LINGUA)/%.po: %.dbk po4a-updatepo --format docbook --master $< --po $@ endif version.ent: echo '' > $@ echo '' >> $@ .PHONY: clean clean: rm -f *.fo *.html *.pdf *.txt rm -rf $(LANGS) rm -f version.ent rm -f `find . -name "*~" -o -name "*.bak"` rm -f *~ *.bak .#* core .PHONY: distclean distclean: clean rm -f *.rej *.orig # if rule bomb out, delete the target .DELETE_ON_ERROR: