chiark / gitweb /
build and clean stuff with the top-level makefile, not debian/rules;
authoraph <aph@313b444b-1b9f-4f58-a734-7bb04f332e8d>
Mon, 22 Jan 2001 05:14:07 +0000 (05:14 +0000)
committeraph <aph@313b444b-1b9f-4f58-a734-7bb04f332e8d>
Mon, 22 Jan 2001 05:14:07 +0000 (05:14 +0000)
build support for non-English languages, and build those by default as
well

git-svn-id: svn://anonscm.debian.org/ddp/manuals/trunk/developers-reference@1088 313b444b-1b9f-4f58-a734-7bb04f332e8d

Makefile
debian/rules

index 914d8fe..703959d 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -3,19 +3,83 @@
 MANUAL         := $(notdir $(shell pwd))
 PUBLISHDIR     := ../../../public_html/manuals.html
 
-all: build
+TARGETS                := $(foreach fmt,html txt pdf,developers-reference.$(fmt)) \
+                  $(foreach langext,.ja .fr, \
+                     $(foreach fmt,html txt pdf,developers-reference$(langext).$(fmt)))
 
-publish:       build
+# programs for creating output
+DEBIANDOC2HTML := debiandoc2html -d debiandoc.decl -c
+DEBIANDOC2TEXT := debiandoc2text -d debiandoc.decl
+DEBIANDOC2LATEX        := debiandoc2latex -d debiandoc.decl
+
+MAX_TEX_RECURSION := 5
+
+.PHONY:        all
+all:    $(TARGETS)
+
+publish:       all
        [ -d $(PUBLISHDIR) ] || exit 1
        rm -f $(PUBLISHDIR)/$(MANUAL)/*.html
        install -d -m 755 $(PUBLISHDIR)/$(MANUAL)
        install -m 644 --preserve-timestamps $(MANUAL).html/*.html      \
           $(PUBLISHDIR)/$(MANUAL)
 
-.PHONY:        build
-build:
-       debian/rules build
+
+developers-reference.html:     developers-reference.sgml
+       $(DEBIANDOC2HTML) -l C $<
+
+developers-reference.%.html:   developers-reference.%.sgml
+       $(DEBIANDOC2HTML) -l $* $<
+
+developers-reference.txt:      developers-reference.sgml
+       $(DEBIANDOC2TEXT) -l C -O $< > $@
+
+developers-reference.%.txt:    developers-reference.%.sgml
+       $(DEBIANDOC2TEXT) -l $* -O $< > $@
+
+developers-reference.tex:      developers-reference.sgml
+       $(DEBIANDOC2LATEX) -l C -O $< > $@
+
+developers-reference.%.tex:    developers-reference.%.sgml
+       $(DEBIANDOC2LATEX) -l $* -O $< > $@
+
+%.pdf: %.tex
+#       note that I have seen bi-stable .aux files, thus we check two levels deep
+       -cp -pf prior.aux pprior.aux 2>/dev/null
+       -cp -pf $(basename $<).aux prior.aux 2>/dev/null
+#       fail if we don't have pdflatex correctly installed
+       kpsewhich pdflatex.fmt >/dev/null
+#       due to a bug in debiandoc2latex2e output, this might fail
+       -pdflatex '\nonstopmode\input{$<}' >/dev/null # see $(@:.pdf=.log) for details
+       @set -e                                                         ;\
+       if ! cmp $(basename $<).aux prior.aux 2>/dev/null &&            \
+          ! cmp $(basename $<).aux pprior.aux 2>/dev/null; then        \
+               if expr $(MAKELEVEL) '<' $(MAX_TEX_RECURSION) >/dev/null;\
+               then                                                    \
+                  echo "remaking $@ (take $(MAKELEVEL))"               ;\
+                  rm -f $@                                             ;\
+                  $(MAKE) $@                                           ;\
+               else                                                    \
+                  echo "E: $@ needs remaking, but we have reached max. level, $(MAX_TEX_RECURSION)" ;\
+               fi                                                      \
+       fi
+       rm -f prior.aux pprior.aux
+
+
+
+version.ent:
+       ./debian/rules $@
 
 .PHONY: clean
 clean:
-       debian/rules clean
+       rm -rf developers-reference*.html
+       rm -f developers-reference*.txt developers-reference*.pdf \
+             developers-reference*.ps developers-reference*.lout* lout.li \
+             developers-reference*.sasp* developers-reference*.tex \
+             developers-reference*.aux developers-reference*.toc \
+             developers-reference*.idx developers-reference*.log \
+             developers-reference*.out
+       rm -f version.ent
+       rm -f `find . -name "*~"`
+
+developers-reference$(SRCEXT).sgml: version.ent common.ent
\ No newline at end of file
index dd2c897..7a8d97e 100755 (executable)
@@ -24,27 +24,20 @@ DEB_VERSION := $(shell LC_ALL=C dpkg-parsechangelog | grep '^Version: ' | sed 's
 # pretty-print the date
 DATE           := $(shell LC_ALL=C date --date="`dpkg-parsechangelog | grep '^Date: ' | sed 's/^Date: *//'`" '+%d %B, %Y')
 
-build: developers-reference.sgml
-       $(checkdir)
-       rm -f version.ent
+version.ent:
+       :> version.ent
        echo "<!entity version \"$(DEB_VERSION)\">" >> version.ent
        echo "<!entity date    \"$(DATE)\">"        >> version.ent
-       nsgmls -wall -s -E20 $^         # check SGML syntax
-       debiandoc2html $^
-       debiandoc2text $^
-       debiandoc2latexpdf -p letter $^
+
+build:
+       $(checkdir)
+       $(MAKE)
        touch build
 
 clean:
        $(checkdir)
+       $(MAKE) clean
        rm -f build
-       rm -rf developers-reference.html
-       rm -f developers-reference.txt* developers-reference.ps \
-         developers-reference.pdf developers-reference.lout* lout.li   \
-         developers-reference.sasp* developers-reference.tex           \
-         developers-reference.aux developers-reference.toc             \
-         developers-reference.idx version.ent
-       rm -f `find . -name "*~"`
        rm -rf $(prefix)
        rm -f debian/files* core debian/substvars