chiark / gitweb /
Sec "Mailing Lists": where to find private archives, closes: #96780
[developers-reference.git] / Makefile
1 # Makefile, used for the DDP manuals.sgml area
2
3 MANUAL          := $(notdir $(shell pwd))
4 PUBLISHDIR      := ../../../public_html/manuals.html
5
6 SOURCES         := $(wildcard *.sgml)
7
8 TARGETS         := $(foreach fmt,html txt pdf,developers-reference.$(fmt)) \
9                      $(filter-out developers-reference.ja.pdf, \
10                        $(foreach langext,.ja .fr, \
11                          $(foreach fmt,html txt pdf,developers-reference$(langext).$(fmt))))
12
13 # programs for creating output
14 DEBIANDOC2HTML  := debiandoc2html -c
15 DEBIANDOC2TEXT  := debiandoc2text
16 DEBIANDOC2LATEX := debiandoc2latex
17
18 make_directory  := install -d -m 755
19 install_file    := install -m 644 -p
20
21 MAX_TEX_RECURSION := 5
22
23 .PHONY: all
24 all:    $(TARGETS)
25
26 .PHONY: validate
27 validate:       $(addsuffix .validate,$(SOURCES))
28
29 # hmmm, this rule may need to be revised/tested
30 publish:        all
31         [ -d $(PUBLISHDIR) ] || exit 1
32         rm -f $(PUBLISHDIR)/$(MANUAL)/*.html
33         $(make_directory) $(PUBLISHDIR)/$(MANUAL)
34         $(install_file) developers-reference*.html/*.html       \
35            $(PUBLISHDIR)/$(MANUAL)
36
37 developers-reference.html:      developers-reference.sgml
38         $(DEBIANDOC2HTML) -l C $<
39
40 developers-reference.%.html:    developers-reference.%.sgml
41         $(DEBIANDOC2HTML) -l $* $<
42
43 developers-reference.txt:       developers-reference.sgml
44         $(DEBIANDOC2TEXT) -l C -O $< > $@
45
46 developers-reference.%.txt:     developers-reference.%.sgml
47         $(DEBIANDOC2TEXT) -l $* -O $< > $@
48
49 developers-reference.tex:       developers-reference.sgml
50         $(DEBIANDOC2LATEX) -l C -O $< > $@
51
52 developers-reference.%.tex:     developers-reference.%.sgml
53         $(DEBIANDOC2LATEX) -l $* -O $< > $@
54
55 %.pdf:  %.tex
56 #        note that I have seen bi-stable .aux files, thus we check two levels deep
57         -cp -pf prior.aux pprior.aux 2>/dev/null
58         -cp -pf $(basename $<).aux prior.aux 2>/dev/null
59 #        fail if we don't have pdflatex correctly installed
60         kpsewhich pdflatex.fmt >/dev/null
61 #        due to a bug in debiandoc2latex2e output, this might fail
62         -pdflatex '\nonstopmode\input{$<}' >/dev/null # see $(@:.pdf=.log) for details
63         @set -e                                                         ;\
64         if ! cmp $(basename $<).aux prior.aux 2>/dev/null &&            \
65            ! cmp $(basename $<).aux pprior.aux 2>/dev/null; then        \
66                 if expr $(MAKELEVEL) '<' $(MAX_TEX_RECURSION) >/dev/null;\
67                 then                                                    \
68                    echo "remaking $@ (take $(MAKELEVEL))"               ;\
69                    rm -f $@                                             ;\
70                    $(MAKE) $@                                           ;\
71                 else                                                    \
72                    echo "E: $@ needs remaking, but we have reached max. level, $(MAX_TEX_RECURSION)" ;\
73                 fi                                                      \
74         fi
75         rm -f prior.aux pprior.aux
76
77 version.ent:    debian/changelog
78         ./debian/rules $@
79
80 %.validate : %
81         nsgmls -wall -gues $<
82         touch $@
83
84 USERMAP := ../../ddp/CVSROOT/users
85 .PHONY: prepare
86 prepare:
87         @[ -f CVS/Root -a -f $(USERMAP) ] || \
88                 ( echo "silly rabbit, prepare is for Adam" 1>&2; exit 1 )
89         cvs2cl -r --usermap $(USERMAP)
90         cvs ci -m "update for next release" ChangeLog
91
92 .PHONY: clean
93 clean:
94         rm -rf developers-reference*.html
95         rm -f developers-reference*.txt developers-reference*.pdf \
96               developers-reference*.ps developers-reference*.lout* lout.li \
97               developers-reference*.sasp* developers-reference*.tex \
98               developers-reference*.aux developers-reference*.toc \
99               developers-reference*.idx developers-reference*.log \
100               developers-reference*.out developers-reference*.dvi
101         rm -f version.ent
102         rm -f `find . -name "*~" -o -name "*.bak"`
103         rm -f *.validate
104         rm -f *~ *.bak .#* core
105
106 .PHONY: distclean
107 distclean: clean
108         rm -f *.rej *.orig
109
110 developers-reference$(SRCEXT).sgml: version.ent common.ent
111
112 html: $(MANUAL).html