chiark / gitweb /
html, txt, and pdf do build for en, fr, and ja.
[developers-reference.git] / Makefile
index 3af4f955938e164ff379251d5aaa45608e073be4..fc0e423a42828cf62353e601e0a182bc7995c092 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -2,99 +2,90 @@
 
 SOURCES                := $(wildcard *.dbk)
 
 
 SOURCES                := $(wildcard *.dbk)
 
-LANGS           := fr
-TARGETS                := $(foreach fmt,html txt pdf,developers-reference.$(fmt)) \
-                    $(foreach langext,$(LANGS), \
-                      $(foreach fmt,html txt pdf,developers-reference.$(langext).$(fmt)))
-
+FORMATS                := html txt pdf
+LANGS           := fr ja
+TARGETS                := $(foreach fmt,$(FORMATS),developers-reference.$(fmt)) \
+                  $(foreach lng,$(LANGS), \
+                      $(foreach fmt,$(FORMATS), \
+                          $(lng)/developers-reference.$(fmt)))
 # programs for creating output
 # programs for creating output
-DEBIANDOC2HTML := debiandoc2html -c
-DEBIANDOC2TEXT := debiandoc2text
-DEBIANDOC2LATEX        := debiandoc2latex
-DEBIANDOC2PS   := debiandoc2latexps
-DEBIANDOC2PDF  := debiandoc2latexpdf
-
-htmllink       := echo "<!entity % htmltext \"INCLUDE\">" > dynamic.ent
-nohtmllink     := echo "<!entity % htmltext \"IGNORE\">" > dynamic.ent
-
-make_directory := install -d -m 755
-install_file   := install -m 644 -p
-
 XP=xsltproc --nonet --novalid --xinclude
 XP=xsltproc --nonet --novalid --xinclude
-
 XL=xmllint --nonet --noout --postvalid --xinclude
 XL=xmllint --nonet --noout --postvalid --xinclude
+# fop is currently in contrib, but can go to main, see #366783
+# alternatives: docbook2pdf (seems to die on UTF-8), dblatex (0.2.4
+# just hangs here) and xmllint (not mature enough, waits in NEW)
+FOP=fop
+# The "-k 0" should be removed as soon as the translations are ready
+TRANSLATE=po4a-translate -f docbook -k 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
 # 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
 # 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
 # all in one file
 DBK2HTML1=--stringparam section.autolabel 1 \
     $(DOCBOOK_XSL)/xhtml/docbook.xsl
+DBK2FO=$$TOP/fop.xsl
+#    $(DOCBOOK_XSL)/fo/docbook.xsl
 
 
-DBK2FO=--stringparam double.sided 1 \
-    --stringparam draft.mode no \
-    --stringparam paper.type A4 \
-    $(DOCBOOK_XSL)/fo/docbook.xsl
-# fop is currently in contrib, but can go to main now, AFAIK
-# alternatives: docbook2pdf (seems to die on UTF-8), dblatex (0.2.4
-# just hangs here) and xmllint (not mature enough, waits in NEW)
-FOP=fop
-
-.PHONY:        all dropold
-all:    $(TARGETS) dropold
-
-dropold:
-       -rm -rf developers-reference.ja.html
+.PHONY:        all
+all:    $(TARGETS)
 
 .PHONY: validate
 validate:
        $(XL) index.dbk
 
 
 .PHONY: validate
 validate:
        $(XL) index.dbk
 
-.PHONY: developers-reference.html
-developers-reference.html:     $(SOURCES)
-       $(XP) $(DBK2HTML) index.dbk
-
-developers-reference.%.html:   developers-reference.%.sgml
-       $(htmllink)
-       $(DEBIANDOC2HTML) -l $* $<
-
-developers-reference.txt:      $(SOURCES)
-       $(XP) $(DBK2HTML1) 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))
+       mkdir -p $(@D) || true
+       cd $(@D) && $(XP) $(DBK2HTML) index.dbk
+
+# There must be an easier way than recursive make!
+.PRECIOUS:             %.dbk
+ifndef LINGUA
+%.dbk: FORCE
+       [ "$$LINGUA" = . ] || make $@ LINGUA=$(@D)
+FORCE:
+else
+#.SECONDARY:           $(LINGUA)/%.dbk
+$(LINGUA)/%.dbk:       %.dbk $(patsubst %.dbk,po4a/$(LINGUA)/%.po,%.dbk)
+       $(TRANSLATE) -m $< -p po4a/$(@:.dbk=.po) -l $@
+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 > $@
 
            | w3m -cols 65 -dump -T text/html > $@
 
-developers-reference.%.txt:    developers-reference.%.sgml
-       $(nohtmllink)
-       $(DEBIANDOC2TEXT) -l $* -O $< > $@
+developers-reference.fo:       $(PWD)/developers-reference.fo
+       @true
 
 
-developers-reference.fo:       $(SOURCES)
-       $(XP) $(DBK2FO) index.dbk > $@
+%/developers-reference.fo:     $(addprefix %/,$(SOURCES)) fop.xsl
+       TOP=`pwd` && cd $(@D) && $(XP) $(DBK2FO) index.dbk > $(@F)
 
 
-developers-reference.pdf:       developers-reference.fo
+developers-reference.pdf:       $(PWD)/developers-reference.pdf
+%/developers-reference.pdf:     %/developers-reference.fo
        $(FOP) -fo $< -pdf $@
 
        $(FOP) -fo $< -pdf $@
 
-developers-reference.%.pdf:     developers-reference.%.sgml
-       $(nohtmllink)
-       $(DEBIANDOC2PDF) -l $* $<
-
 version.ent:   debian/changelog
        ./debian/rules $@
 
 version.ent:   debian/changelog
        ./debian/rules $@
 
-%.validate : % version.ent
-       nsgmls -wall -gues $<
-       touch $@
-
 .PHONY: clean
 clean:
        rm -f *.fo *.html *.pdf *.txt
 .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 version.ent
        rm -f `find . -name "*~" -o -name "*.bak"`
-       rm -f *.validate
        rm -f *~ *.bak .#* core
 
 .PHONY: distclean
        rm -f *~ *.bak .#* core
 
 .PHONY: distclean