X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=developers-reference.git;a=blobdiff_plain;f=Makefile;h=54f9c1e58b1163e3257c9a235761ad37e92d5d51;hp=2dfbe39998ed8c11d1521fdcae819c004595fb2e;hb=927e904966a6ba5bc30ec634fb21a97d4d4c9c2b;hpb=c81927355fe51c8a09827d098d0caad05a052d67 diff --git a/Makefile b/Makefile index 2dfbe39..54f9c1e 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,8 @@ # Makefile, used for the developers-reference in DocBook XML -SOURCES := $(wildcard *.dbk *.ent) +# Note: This Makefile should work perfectly without the debian/ directory. + +SOURCES := $(wildcard *.dbk) common.ent version.ent FORMATS := html txt pdf LANGS := fr ja @@ -8,35 +10,36 @@ TARGETS := $(foreach fmt,$(FORMATS),developers-reference.$(fmt)) \ $(foreach lng,$(LANGS), \ $(foreach fmt,$(FORMATS), \ $(lng)/developers-reference.$(fmt))) +# list of targets, that currently cannot build +BLACKLIST := ja/developers-reference.pdf + +# 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 +# dblatex 0.2.8 has some problems (e.g. #465221 and Japanese does +# not build) # 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 "-k 0" should be removed as soon as the translations are ready -TRANSLATE=po4a-translate -f docbook -k 0 +# - fop is currently in contrib, but can go to main, see #366783 +# - xmlroff (not mature enough, #182445) +DBLATEX=dblatex --style=db2latex +# 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 +# for HTML output +DBK2HTML=$(CURDIR)/html.xsl +# all in one file for text output +DBK2HTML1=$(CURDIR)/txt.xsl .PHONY: all -all: $(TARGETS) +all: $(filter-out $(BLACKLIST), $(TARGETS)) .PHONY: validate validate: $(SOURCES) @@ -45,13 +48,26 @@ validate: $(SOURCES) %/validate: $(addprefix %/,$(SOURCES)) cd $(@D) && $(XL) index.dbk +# This rule controls the build and installation on the website +# Logs are here: http://www-master.debian.org/build-logs/ddp/ +.PHONY: publish +publish: all + [ -d $(PUBLISHDIR) ] || exit 1 + install -d -m 755 $(PUBLISHDIR)/developers-reference + rm -f $(PUBLISHDIR)/developers-reference/*.html + rm -f en && ln -sf . en + $(foreach format,$(FORMATS),$(foreach lang,en $(LANGS),for file in $(lang)/*.$(format); do if [ -e "$$file" ]; then cp $$file $(PUBLISHDIR)/developers-reference/$$(basename $$file .$(format)).$(lang).$(format); fi; done;)) + ln -sf index.en.html $(PUBLISHDIR)/developers-reference/index.html + ln -sf developers-reference.en.pdf $(PUBLISHDIR)/developers-reference/developers-reference.pdf + ln -sf developers-reference.en.txt $(PUBLISHDIR)/developers-reference/developers-reference.txt + .PHONY: developers-reference.html %/developers-reference.html -developers-reference.html: $(PWD)/index.html +developers-reference.html: $(CURDIR)/index.html %/developers-reference.html: $(addprefix %/,index.html) @true .PRECIOUS: %/index.html -index.html: $(PWD)/developers-reference.html +index.html: $(CURDIR)/developers-reference.html %/index.html: $(addprefix %/,$(SOURCES)) cd $(@D) && $(XP) $(DBK2HTML) index.dbk @@ -59,38 +75,47 @@ index.html: $(PWD)/developers-reference.html .PRECIOUS: %.dbk %.ent ifndef LINGUA %.dbk %.ent: FORCE - [ "$$LINGUA" = . ] || $(MAKE) $@ LINGUA=$(@D) + $(MAKE) $@ LINGUA=`basename $(@D)` + FORCE: else $(LINGUA)/%.dbk: %.dbk $(patsubst %.dbk,po4a/$(LINGUA)/%.po,%.dbk) $(TRANSLATE) -m $< -p po4a/$(@:.dbk=.po) -l $@ -$(LINGUA)/%.ent: %.ent +$(LINGUA)/common.ent: common.ent cd $(@D) && ln -sf ../$(@F) . endif -developers-reference.txt: $(PWD)/developers-reference.txt +developers-reference.txt: $(CURDIR)/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 $@ + | w3m -cols 70 -dump -no-graph -T text/html > $@ + +developers-reference.pdf: $(CURDIR)/developers-reference.pdf +%/developers-reference.pdf: $(addprefix %/,$(SOURCES)) + TOP=`pwd` && cd $(@D) && $(DBLATEX) index.dbk \ + && mv index.dbk.pdf $(@F) + +.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: debian/changelog - ./debian/rules $@ +%/version.ent: + echo '' > $@ + echo '' >> $@ .PHONY: clean clean: rm -f *.fo *.html *.pdf *.txt - rm -rf $(LANGS) + for L in $(LANGS); do rm -rf `basename ./"$$L"/`; done rm -f version.ent rm -f `find . -name "*~" -o -name "*.bak"` rm -f *~ *.bak .#* core