/[ddp]/manuals/trunk/securing-howto/Makefile
ViewVC logotype

Contents of /manuals/trunk/securing-howto/Makefile

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2949 - (show annotations) (download)
Sat Mar 26 16:06:07 2005 UTC (8 years, 2 months ago) by jseidel
File size: 7312 byte(s)
added zh-cn and improved locale usage
1 #
2 # Based Makefile Template from Osamu Aoki
3 #
4 # Build html(multi-page), txt, ps, pdf, and other formats.
5 #
6 # Should work both for a manual in the Debian Documentation Project
7 # manuals.sgml tree, and for the package build.
8 # ------------------------------------------------------------------- #
9 # WARNING #
10 # Use with caution, aimed at Woody system #
11 # "ps" and "pdf" tends to break in some ill-configured systems #
12 # ------------------------------------------------------------------- #
13 # Read local texmf.cnf file
14
15 export PATH:=../quick-reference/bin/:${PATH}
16
17 # Woodys default LaTeX settings need more memory for en PDF
18 export TEXMFCNF:=../quick-reference/texmf/:
19
20 .SUFFIXES:
21
22 # Following default shall be edited by the coordinator for the entire
23 # set of languages. If a subsection owner wishes to override settings,
24 # they can be overridden by running make with "make 'LANGS1=fi'" etc..
25
26 # =================================================================== #
27 # Default configuration part: Customize #
28 # =================================================================== #
29
30 # The directory in which this makefile resides must also contain a file
31 # called <directoryname>.[<language>.]sgml, which is the top-level file
32 # for the manual in this directory.
33
34 # Basename for language-dependent SGML (DDP default, generated)
35 MANUAL := securing-debian-howto
36
37 # Basename for language-independent SGML-template.
38 MANUAL0 := $(MANUAL)
39
40 # Build type: Possible values are BUILD_TYPE = web|package
41 BUILD_TYPE := web
42
43 # Publish directory
44 # This can and will be overridden by a higher level makefile
45 PUBLISHDIR := ~/public_html/manuals.html
46
47 # List of languages built for "distclean" target for DDP:
48 LANGSALL := en de fr es it ru ja zh-cn
49 # List of languages built for "publish" target for DDP
50 LANGS := en de fr es it ru ja zh-cn
51
52 # Files which affect SGML generation (excluding *.sgml)
53 SGMLENTS := custom.ent default.ent
54
55 # All SGML source files
56 SGMLSRCS := $(foreach lang, $(LANGS), $(MANUAL).$(lang).sgml) \
57 $(foreach lang, $(LANGS), $(wildcard $(lang)/*.sgml ) ) \
58 $(SGMLENTS)
59
60 # =================================================================== #
61 # Build target default part: Routine #
62 # =================================================================== #
63 # If some languages have problems building, filter-out in here.
64
65 # define $(locale) for the following targets
66 $(MANUAL).%.html.stamp $(MANUAL).%.txt $(MANUAL).%.ps $(MANUAL).%.pdf: \
67 locale=$(subst pt-br,pt_BR,\
68 $(subst zh-cn,zh_CN,\
69 $*))
70
71 ### Full guide
72
73 # List of html stamp files to be built
74 HTMLS := $(foreach lang,$(LANGS),$(MANUAL).$(lang).html.stamp)
75
76 # List of txt to be built
77 TXTS := $(foreach lang,$(LANGS),$(MANUAL).$(lang).txt)
78
79 # List of ps to be built
80 PSS := $(foreach lang,$(LANGS),$(MANUAL).$(lang).ps)
81
82 # List of pdf to be built
83 PDFS := $(foreach lang,$(LANGS),$(MANUAL).$(lang).pdf)
84
85
86 # =================================================================== #
87 # Build target part: Customize #
88 # =================================================================== #
89 # If some languages have problems building, filter-out in here.
90
91 all: html txt ps pdf
92 html: $(HTMLS)
93 text txt: $(TXTS)
94 ps: $(PSS)
95 pdf: $(PDFS)
96
97 publish: publish-html publish-txt publish-ps publish-pdf
98
99 # =================================================================== #
100 # Build rule part: If not package build #
101 # =================================================================== #
102
103 $(MANUAL).%.ent:
104 echo "<!ENTITY language \"$*\">" > $@
105 echo "<!ENTITY % lang-$* \"INCLUDE\">" >> $@
106 echo "<!ENTITY docdate \"`LC_ALL=C date -R`\">" >> $@
107 echo "<!ENTITY docversion \"CVS\">" >> $@
108
109
110 # =================================================================== #
111 # Build rule part: Routine #
112 # =================================================================== #
113
114 # SGML
115
116 # Create starting SGML for each language from the template. Actual
117 # contents reside in language-segregated subdirectories.
118
119 $(MANUAL).%.sgml: $(MANUAL0).sgml
120 sed -e "s/@@LANGS@@/$*/g" \
121 -e "s/@@DIRS@@/$*/g" \
122 -e "s/@@NAME@@/$(MANUAL)/g" \
123 $< > $(MANUAL).$*.sgml
124
125 # HTML
126 $(MANUAL).%.html.stamp: $(MANUAL).%.sgml $(MANUAL).%.ent $(SGMLSRCS)
127 debiandoc2html -l $(locale) -c $<
128 # since $(MANUAL).%.html/index.%.html cannot be a target file
129 @for file in `ls $(MANUAL).$*.html/*` ; do\
130 newfile=`echo $$file|\
131 sed 's/$(shell echo $*|\
132 sed 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ_/abcdefghijklmnopqrstuvwxyz-/'\
133 )\.html/$*\.html/'`;\
134 if [ $$file != $$newfile ] ; then\
135 mv $$file $$newfile;\
136 echo "Rename $$file --> $$newfile";\
137 fi\
138 done
139 touch $(MANUAL).$*.html.stamp
140
141 # TXT
142
143 $(MANUAL).%.txt: $(MANUAL).%.sgml $(MANUAL).%.ent $(SGMLSRCS)
144 debiandoc2text -l $(locale) $<
145
146
147 # PS
148
149 $(MANUAL).%.ps: $(MANUAL).%.sgml $(MANUAL).%.ent $(SGMLSRCS)
150 debiandoc2latexps -l $(locale) $<
151
152 # PDF
153
154 $(MANUAL).%.pdf: $(MANUAL).%.sgml $(MANUAL).%.ent $(SGMLSRCS)
155 debiandoc2latexpdf -l $(locale) $<
156
157
158 # =================================================================== #
159 # Build rule part: Web publish #
160 # =================================================================== #
161
162 publish-html: html
163 test -d $(PUBLISHDIR)/$(MANUAL) \
164 || install -d -m 755 $(PUBLISHDIR)/$(MANUAL)
165 rm -f $(PUBLISHDIR)/$(MANUAL)/*.html
166 # install all html
167 $(foreach lang,$(LANGS),\
168 install -p -m 644 $(MANUAL).$(lang).html/*.html \
169 $(PUBLISHDIR)/$(MANUAL)/ ;\
170 )
171 publish-txt: txt
172 test -d $(PUBLISHDIR)/$(MANUAL) \
173 || install -d -m 755 $(PUBLISHDIR)/$(MANUAL)
174 rm -f $(PUBLISHDIR)/$(MANUAL)/*.txt
175 # install all txt
176 @$(foreach lang,$(LANGS),\
177 install -p -m 644 $(MANUAL).$(lang).txt \
178 $(PUBLISHDIR)/$(MANUAL)/ ;\
179 )
180
181 publish-ps: ps
182 test -d $(PUBLISHDIR)/$(MANUAL) \
183 || install -d -m 755 $(PUBLISHDIR)/$(MANUAL)
184 rm -f $(PUBLISHDIR)/$(MANUAL)/*.ps
185 # install all ps
186 @$(foreach lang,$(LANGS),\
187 install -p -m 644 $(MANUAL).$(lang).ps \
188 $(PUBLISHDIR)/$(MANUAL)/ ;\
189 )
190
191
192 publish-pdf: pdf
193 test -d $(PUBLISHDIR)/$(MANUAL) \
194 || install -d -m 755 $(PUBLISHDIR)/$(MANUAL)
195 rm -f $(PUBLISHDIR)/$(MANUAL)/*.pdf
196 # install all pdf1
197 @$(foreach lang,$(LANGS),\
198 install -p -m 644 $(MANUAL).$(lang).pdf \
199 $(PUBLISHDIR)/$(MANUAL)/ ;\
200 )
201
202
203 #====[ validating SGML ]=======================================================
204 validate:
205 set -x; for i in $(LANGS); do $(MAKE) validate1-$$i ; done
206
207 validate1-%: $(SGMLSRCS) $(MANUAL)-%.ent
208 nsgmls -gues -wall $(MANUAL)-$*.sgml
209
210
211 #====[ cleaning up ]===========================================================
212 distclean: clean
213 rm -Rf $(PUBLISHDIR)/$(MANUAL)
214 rm -f *.error $(MANUAL).*.sgml
215
216 clean:
217 rm -f $(MANUAL)*.{txt,ps,dvi,pdf,info*,log,tex,aux,toc,sasp*,out,tov}
218 rm -f *~ prior.aux pprior.aux tar.gz.log
219 rm -f *.error $(MANUAL).*.ent $(MANUAL).*.sgml date.ent $(MANUAL).*.tpt
220 rm -rf $(MANUAL)*.html *stamp
221
222 .PHONY: all html text txt ps pdf \
223 publish publish-html publish-tst publish-ps publish-pdf \
224 clean distclean validate
225

  ViewVC Help
Powered by ViewVC 1.1.5