chiark / gitweb /
[dev-ref] Prepare 3.4.7 upload
[developers-reference.git] / Makefile
index 2d70910d5af8abde15cec83531e8161a54a4a5ba..cfc064bd7ac0d5e85546c3f3226a836e653696ac 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -5,11 +5,13 @@
 SOURCES                := $(wildcard *.dbk) common.ent version.ent
 
 FORMATS                := html txt pdf
-LANGS           := fr ja
+LANGS           := de fr ja
 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
@@ -18,9 +20,8 @@ PUBDATE=unknown
 # programs for creating output
 XP=xsltproc --nonet --novalid --xinclude
 XL=xmllint --nonet --noout --postvalid --xinclude
-# dblatex 0.2.8 has some problems (e.g. #465221), but we can
-# live with that for now (but: Japanese PDF seems to need
-# non-free cyberbit font.)
+# dblatex 0.2.8 has some problems (e.g. #465221 and Japanese does
+# not build)
 # Alternatives:
 # - docbook2pdf (seems to die on UTF-8, #431085); and
 # - fop is currently in contrib, but can go to main, see #366783
@@ -33,12 +34,12 @@ TRANSLATE=po4a-translate --format docbook --keep 0
 # note: the URL is used as identifier, no HTTP is used!
 DOCBOOK_XSL=http://docbook.sourceforge.net/release/xsl/current
 # for HTML output
-DBK2HTML=$(PWD)/html.xsl
+DBK2HTML=$(CURDIR)/html.xsl
 # all in one file for text output
-DBK2HTML1=$(PWD)/txt.xsl
+DBK2HTML1=$(CURDIR)/txt.xsl
 
 .PHONY:        all
-all:    $(TARGETS)
+all:    $(filter-out $(BLACKLIST), $(TARGETS))
 
 .PHONY: validate
 validate:                      $(SOURCES)
@@ -47,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 --preserve=timestamps $$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
 
@@ -61,26 +75,32 @@ index.html:                 $(PWD)/developers-reference.html
 .PRECIOUS:             %.dbk %.ent
 ifndef LINGUA
 %.dbk %.ent: FORCE
-       $(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 $@
+       $(TRANSLATE) -m $< -p po4a/$(@:.dbk=.po) -l $@ -a ?po4a/$(@:.dbk=.add)
 
 $(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 > $@
+           | w3m -o display_charset=UTF-8 -cols 70 -dump -no-graph -T text/html > $@
+
+XSLT           := xslt
 
-developers-reference.pdf:       $(PWD)/developers-reference.pdf
+developers-reference.pdf:       $(CURDIR)/developers-reference.pdf
 %/developers-reference.pdf:     $(addprefix %/,$(SOURCES))
-       TOP=`pwd` && cd $(@D) && $(DBLATEX) index.dbk \
-           && mv index.dbk.pdf $(@F)
+       $(DBLATEX) $(@D)/index.dbk \
+           --backend=xetex \
+           --xsl-user=$(XSLT)/user_param.xsl \
+           --xsl-user=$(XSLT)/xetex_param.xsl \
+           --param=lingua=$(@D) \
+           && mv $(@D)/index.dbk.pdf $@
 
 .PHONY: pot
 pot:                           $(patsubst %.dbk,po4a/po/%.pot,$(SOURCES))
@@ -91,9 +111,20 @@ ifdef LINGUA
 .PHONY: updatepo
 updatepo:                      $(patsubst %.dbk,po4a/$(LINGUA)/%.po,$(SOURCES))
 po4a/$(LINGUA)/%.po:           %.dbk
-       po4a-updatepo --format docbook --master $< --po $@
+       po4a-updatepo --previous --format docbook --master $< --po $@
 endif
 
+tidypo:
+       for po in $(wildcard po4a/*/*.po po4a/*/*.pot); do \
+           msgcat $$po > $$po.tmp && mv $$po.tmp $$po; \
+       done
+
+checkpo:
+       @for po in $(wildcard po4a/*/*.po po4a/*/*.pot); do \
+           echo $$po; \
+           msgfmt --check --verbose $$po; \
+       done
+
 %/version.ent:
        echo '<!ENTITY version "$(VERSION)">' >  $@
        echo '<!ENTITY pubdate "$(PUBDATE)">' >> $@
@@ -101,7 +132,7 @@ endif
 .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