source: trunk/adm/makefile @ 94

Last change on this file since 94 was 94, checked in by pinsard, 14 years ago

add man troff output of manuals

  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 11.5 KB
Line 
1#+
2#
3# module
4# ======
5#
6# generation of documentation of superbib
7#
8# TODO
9# ====
10#
11# ++ amélioration de la page index
12#
13# EVOLUTIONS
14# ==========
15#
16# $Id$
17#
18# - fplod 20100310T091541Z aedon.locean-ipsl.upmc.fr (Darwin)
19#   
20#   * add man_troff which sheel script possible now with docutils 0.6
21#     can be test with
22#      $ man -M ../doc//manuals/man bibopa.sh
23#
24# - fplod 2009-05-13T14:08:49Z aedon.locean-ipsl.upmc.fr (Darwin)
25#
26#   * implicit rules
27#
28#     nb : may be will only work wih GNU make
29#     but easier to update : only one line to add in thi makefile when
30#     a new file is added in $(DIRSRC) directory
31#
32#   * rst2latex usage of manuals_many.sty and manual_one.sty (for TOC and parindent)
33#   * bug fix for PDF manual (missing one pdf2latex)
34#
35# - fplod 2008-10-28T10:59:44Z aedon.locean-ipsl.upmc.fr (Darwin)
36#
37#   * add newpage directive
38#     (thanks to http://docutils.sourceforge.net/docs/user/latex.html)
39#
40# - fplod 2008-09-17T09:16:08Z aedon.locean-ipsl.upmc.fr (Darwin)
41#   * add xsl files
42#
43# - fplod 2008-09-16T14:59:02Z aedon.locean-ipsl.upmc.fr (Darwin)
44#   * creation
45#
46# SEE ALSO
47# ========
48#
49# extract_rst.sh_
50#
51# .. _extract_rst.sh: ../extract_rst.sh.html
52#
53#-
54#
55PRODUCT = \
56superbib
57
58PRODUCTNAME = \
59$$(echo $(PRODUCT) | tr [:lower:] [:upper:])
60
61DIRSRC = \
62../
63
64DIRADM = \
65./
66
67DIRTMP = \
68./
69
70DIRDESIGN = \
71./design/
72
73DIRWWW = \
74../doc/
75
76URLPUBLISH = \
77http://www.locean-ipsl.upmc.fr/~fplod/projects/$(PRODUCT)
78
79LIST_SRCPHP = \
80$(DIRSRC)/timestamp.php
81
82LIST_SRCPHP_RST = \
83$(shell echo "$(LIST_SRCPHP)" | \
84        sed -e "s+$(DIRSRC)+$(DIRTMP)+g" \
85            -e "s+\.php+.php.rst+g")
86
87LIST_SRCPHP_HTML = \
88$(shell echo "$(LIST_SRCPHP)" | \
89        sed -e "s+$(DIRSRC)+$(DIRWWW)/manuals/html/many/+g" \
90            -e "s+\.php+.php.html+g")
91
92LIST_SRCPHP_PDF = \
93$(shell echo "$(LIST_SRCPHP)" | \
94        sed -e "s+$(DIRSRC)+$(DIRWWW)/manuals/pdf/many/+g" \
95            -e "s+\.php+.php.pdf+g")
96
97LIST_SRCXSL = \
98$(DIRSRC)/components_db.xsl \
99$(DIRSRC)/form_db.xsl \
100$(DIRSRC)/main_html.xsl \
101$(DIRSRC)/message_lang.xsl \
102$(DIRSRC)/superbib01_html.xsl \
103$(DIRSRC)/superbib01_xml.xsl \
104$(DIRSRC)/superbib02_html.xsl \
105$(DIRSRC)/superbib02_xml.xsl \
106$(DIRSRC)/superbibmany01_html.xsl \
107$(DIRSRC)/superbibmany01_xml.xsl \
108$(DIRSRC)/superbibmany02_html.xsl \
109$(DIRSRC)/superbibmany02_xml.xsl \
110$(DIRSRC)/template_db.xsl \
111$(DIRSRC)/user_db.xsl \
112$(DIRSRC)/user_html.xsl
113
114LIST_SRCXSL_RST = \
115$(shell echo "$(LIST_SRCXSL)" | \
116        sed -e "s+$(DIRSRC)+$(DIRTMP)+g" \
117            -e "s+\.xsl+.xsl.rst+g")
118
119LIST_SRCXSL_HTML = \
120$(shell echo "$(LIST_SRCXSL)" | \
121        sed -e "s+$(DIRSRC)+$(DIRWWW)/manuals/html/many/+g" \
122            -e "s+\.xsl+.xsl.html+g")
123
124LIST_SRCXSL_PDF = \
125$(shell echo "$(LIST_SRCXSL)" | \
126        sed -e "s+$(DIRSRC)+$(DIRWWW)/manuals/pdf/many/+g" \
127            -e "s+\.xsl+.xsl.pdf+g")
128
129LIST_SRCSH = \
130$(DIRSRC)/$(PRODUCT)_profile.sh \
131$(DIRSRC)/before.sh \
132$(DIRSRC)/bibopa.sh \
133$(DIRSRC)/install.sh \
134$(DIRSRC)/linkchecker.sh \
135$(DIRSRC)/mailtouser.sh \
136$(DIRSRC)/twindoi.sh
137
138LIST_SRCSH_RST = \
139$(shell echo "$(LIST_SRCSH)" | \
140        sed -e "s+$(DIRSRC)+$(DIRTMP)+g" \
141            -e "s+\.sh+.sh.rst+g")
142
143LIST_SRCSH_TROFF = \
144$(shell echo "$(LIST_SRCSH)" | \
145        sed -e "s+$(DIRSRC)+$(DIRWWW)/manuals/man/man1/+g" \
146            -e "s+\.sh+.sh.1+g")
147
148LIST_SRCSH_HTML = \
149$(shell echo "$(LIST_SRCSH)" | \
150        sed -e "s+$(DIRSRC)+$(DIRWWW)/manuals/html/many/+g" \
151            -e "s+\.sh+.sh.html+g")
152
153LIST_SRCSH_PDF = \
154$(shell echo "$(LIST_SRCSH)" | \
155        sed -e "s+$(DIRSRC)+$(DIRWWW)/manuals/pdf/many/+g" -e "s+\.sh+.sh.pdf+g")
156
157RST2MAN = \
158rst2man.py
159
160RST2HTML = \
161rst2html.py
162
163RST2LATEX = \
164rst2latex.py
165
166RST2LATEX_OPTIONS_ONE = \
167--documentclass=book \
168--stylesheet=manual_one.sty \
169--use-latex-toc \
170--section-numbering \
171--traceback \
172--use-verbatim-when-possible
173
174RST2LATEX_OPTIONS_MANY = \
175--documentclass=article \
176--stylesheet=manuals_many.sty \
177--traceback \
178--use-verbatim-when-possible
179
180.PHONY : \
181help \
182before \
183clean \
184cleantmp \
185design \
186htmllinkcheckb \
187htmllinkchecka \
188spellcheck \
189all \
190man_troff \
191man_html \
192man_html_one \
193man_html_many \
194man_pdf \
195man_pdf_one \
196man_pdf_many
197
198help :
199        @echo "Prepare output directories :"
200        @echo "\$$ make before"
201        @echo ""
202        @echo "Following commands are available to build outputs :"
203        @echo "\$$ make all"
204        @echo " "
205        @echo "Check links before installation : "
206        @echo "\$$ make htmllinkcheckb"
207        @echo " "
208        @echo "Last step = installation"
209        @echo "\$$ make install"
210        @echo " "
211        @echo "Check links after installation : "
212        @echo "\$$ make htmllinkchecka"
213        @echo " "
214
215before :
216        @mkdir -p $(DIRWWW)/manuals/man/man1/
217        @mkdir -p $(DIRWWW)/manuals/html/one/
218        @mkdir -p $(DIRWWW)/manuals/html/many/
219        @mkdir -p $(DIRWWW)/manuals/pdf/one/
220        @mkdir -p $(DIRWWW)/manuals/pdf/many/
221
222install :
223        @install.sh -w $(DIRWWW) -u $(URLPUBLISH)
224
225clean : \
226cleantmp
227        -@rm -fr $(DIRWWW)/
228        -@rm -fr $(DIRWWW)/manuals/html/
229        -@rm -fr $(DIRWWW)/manuals/pdf
230
231cleantmp :
232        -@rm -f $(DIRTMP)/all.xml
233        -@rm -f $(DIRTMP)/*.rst
234        -@rm -f $(DIRTMP)/*.rst[12]
235        -@rm -f $(DIRTMP)/links.rst*
236        -@rm -f $(DIRTMP)/*.tex
237        -@rm -f $(DIRWWW)/manuals/pdf/one/*.aux
238        -@rm -f $(DIRWWW)/manuals/pdf/one/*.log
239        -@rm -f $(DIRWWW)/manuals/pdf/one/*.out
240        -@rm -f $(DIRWWW)/manuals/pdf/many/*.aux
241        -@rm -f $(DIRWWW)/manuals/pdf/many/*.log
242        -@rm -f $(DIRWWW)/manuals/pdf/many/*.out
243
244design : \
245$(DIRDESIGN)/images/$(PRODUCT)_fulldependencies.png \
246$(DIRDESIGN)/images/$(PRODUCT)_fulldependencies.svg
247
248htmllinkcheckb :
249        @linkchecker.sh -d $(DIRWWW)/manuals/html/
250
251htmllinkchecka :
252        @linkchecker.sh -u $(URLPUBLISH)
253
254spellcheck :
255        @++aspell --mode=sgml --master=francais -c \
256        $(DIRSRC)/$(PRODUCT).xml
257
258all : \
259man_troff \
260man_html \
261man_pdf
262
263man_troff : \
264$(LIST_SRCSH_TROFF)
265
266man_html : \
267man_html_one \
268man_html_many
269
270man_html_one : \
271$(DIRWWW)/manuals/html/one/index.html
272
273man_html_many : \
274$(DIRWWW)/manuals/html/many/index.html \
275$(LIST_SRCSH_HTML) \
276$(LIST_SRCXSL_HTML) \
277$(LIST_SRCPHP_HTML)
278
279man_pdf : \
280man_pdf_one \
281man_pdf_many
282
283man_pdf_one : \
284$(DIRWWW)/manuals/pdf/one/$(PRODUCT)_manuals.pdf \
285
286man_pdf_many : \
287$(LIST_SRCSH_PHP) \
288$(LIST_SRCXSL_PHP) \
289$(LIST_SRCPHP_PHP)
290
291$(DIRWWW)/manuals/html/many/index.html : \
292$(DIRTMP)/index_many.rst
293        @$(RST2HTML) --input-encoding=ISO-8859-15 --strict \
294        $< $@
295
296$(DIRWWW)/manuals/html/one/index.html : \
297$(DIRTMP)/$(PRODUCT)_manuals.rst
298        @$(RST2HTML) --input-encoding=ISO-8859-15 --strict \
299        $< $@
300
301$(DIRWWW)/manuals/pdf/one/$(PRODUCT)_manuals.pdf : \
302$(DIRTMP)/$(PRODUCT)_manuals.tex
303        @-pdflatex -output-directory $(DIRWWW)/manuals/pdf/one/ $<
304        @-pdflatex -output-directory $(DIRWWW)/manuals/pdf/one/ $<
305
306$(DIRTMP)/$(PRODUCT)_manuals.tex : \
307$(DIRTMP)/$(PRODUCT)_manuals.rst
308        @$(RST2LATEX) $(RST2LATEX_OPTIONS_ONE) --input-encoding=ISO-8859-15 --strict \
309        $< $@
310
311$(DIRTMP)/$(PRODUCT)_manuals.rst : \
312$(DIRTMP)/index_one.rst \
313$(LIST_SRCSH_RST) \
314$(LIST_SRCXSL_RST) \
315$(LIST_SRCPHP_RST)
316        @cat $(DIRTMP)/index_one.rst > ${DIRTMP}/$(PRODUCT)_manuals.rst1
317        @echo "Shell scripts" >> ${DIRTMP}/$(PRODUCT)_manuals.rst1
318        @echo "=============" >> ${DIRTMP}/$(PRODUCT)_manuals.rst1
319        @for file in $(LIST_SRCSH); \
320        do echo " " >> ${DIRTMP}/$(PRODUCT)_manuals.rst1; \
321        echo " " >> ${DIRTMP}/$(PRODUCT)_manuals.rst1; \
322        echo ".. _$$(basename $${file}) :" >> ${DIRTMP}/$(PRODUCT)_manuals.rst1; \
323        echo " " >> ${DIRTMP}/$(PRODUCT)_manuals.rst1; \
324        echo "$$(basename $${file})" >> ${DIRTMP}/$(PRODUCT)_manuals.rst1; \
325        echo "$$(basename $${file} | tr [:print:] -)" >> ${DIRTMP}/$(PRODUCT)_manuals.rst1 ; \
326        echo " " >> ${DIRTMP}/$(PRODUCT)_manuals.rst1; \
327        sed -e "s/^==*$$/-----------------/" \
328        -e "s/^--*$$/~~~~~~~~~~~~~~~~~~~~/" \
329        ${DIRTMP}/$$(basename $${file}).rst >> ${DIRTMP}/$(PRODUCT)_manuals.rst1; \
330        done
331        @echo " " >> ${DIRTMP}/$(PRODUCT)_manuals.rst1
332        @echo "XSL scripts" >> ${DIRTMP}/$(PRODUCT)_manuals.rst1
333        @echo "===========" >> ${DIRTMP}/$(PRODUCT)_manuals.rst1
334        @echo " " >> ${DIRTMP}/$(PRODUCT)_manuals.rst1
335        @for file in $(LIST_SRCXSL); \
336        do echo " " >> ${DIRTMP}/$(PRODUCT)_manuals.rst1; \
337        echo " " >> ${DIRTMP}/$(PRODUCT)_manuals.rst1; \
338        echo ".. _$$(basename $${file}) :" >> ${DIRTMP}/$(PRODUCT)_manuals.rst1; \
339        echo " " >> ${DIRTMP}/$(PRODUCT)_manuals.rst1; \
340        echo "$$(basename $${file})" >> ${DIRTMP}/$(PRODUCT)_manuals.rst1; \
341        echo "$$(basename $${file} | tr [:print:] -)" >> ${DIRTMP}/$(PRODUCT)_manuals.rst1 ; \
342        echo " " >> ${DIRTMP}/$(PRODUCT)_manuals.rst1; \
343        sed -e "s/^==*$$/-----------------/" \
344        -e "s/^--*$$/~~~~~~~~~~~~~~~~~~~~/" \
345        ${DIRTMP}/$$(basename $${file}).rst >> ${DIRTMP}/$(PRODUCT)_manuals.rst1; \
346        done
347        @echo " " >> ${DIRTMP}/$(PRODUCT)_manuals.rst1
348        @echo "PHP scripts" >> ${DIRTMP}/$(PRODUCT)_manuals.rst1
349        @echo "===========" >> ${DIRTMP}/$(PRODUCT)_manuals.rst1
350        @echo " " >> ${DIRTMP}/$(PRODUCT)_manuals.rst1
351        @for file in $(LIST_SRCPHP); \
352        do echo " " >> ${DIRTMP}/$(PRODUCT)_manuals.rst1; \
353        echo " " >> ${DIRTMP}/$(PRODUCT)_manuals.rst1; \
354        echo ".. _$$(basename $${file}) :" >> ${DIRTMP}/$(PRODUCT)_manuals.rst1; \
355        echo " " >> ${DIRTMP}/$(PRODUCT)_manuals.rst1; \
356        echo "$$(basename $${file})" >> ${DIRTMP}/$(PRODUCT)_manuals.rst1; \
357        echo "$$(basename $${file} | tr [:print:] -)" >> ${DIRTMP}/$(PRODUCT)_manuals.rst1 ; \
358        echo " " >> ${DIRTMP}/$(PRODUCT)_manuals.rst1; \
359        sed -e "s/^==*$$/-----------------/" \
360        -e "s/^--*$$/~~~~~~~~~~~~~~~~~~~~/" \
361        ${DIRTMP}/$$(basename $${file}).rst >> ${DIRTMP}/$(PRODUCT)_manuals.rst1; \
362        done
363
364        @grep "\.\. _.*: .*$$" ${DIRTMP}/$(PRODUCT)_manuals.rst1 > \
365        ${DIRTMP}/links.rst
366        @sed -e "s/^ *//" ${DIRTMP}/links.rst | sort -u > ${DIRTMP}/links.rst2
367        @sed -e "/\.\. _.*: .*$$/d" ${DIRTMP}/$(PRODUCT)_manuals.rst1 > \
368        ${DIRTMP}/$(PRODUCT)_manuals.rst2
369        @cp ${DIRTMP}/$(PRODUCT)_manuals.rst2 $@
370
371$(DIRTMP)/index_one.rst :
372        @echo "=================" >> $@
373        @echo "$(PRODUCTNAME) manuals" >> $@
374        @echo "=================" >> $@
375        @echo " " >> $@
376        @echo ".. contents:: Table of Contents" >> $@
377        @echo "  :depth: 2" >> $@
378        @echo ".. section-numbering::" >> $@
379        @echo " " >> $@
380
381$(DIRTMP)/index_many.rst :
382        @echo "===================" >> $@
383        @echo "$(PRODUCTNAME) tools" >> $@
384        @echo "===================" >> $@
385        @echo " " >> $@
386        @echo "Shell scripts" >> $@
387        @echo "=============" >> $@
388        @for file in $(LIST_SRCSH); do echo " ";echo "$$(basename $${file})_"; echo " "; echo ".. _$$(basename $${file}) : $$(basename $${file}).html"; done >> $@
389        @echo " " >> $@
390        @echo "XSL scripts" >> $@
391        @echo "=============" >> $@
392        @for file in $(LIST_SRCXSL); do echo " ";echo "$$(basename $${file})_"; echo " "; echo ".. _$$(basename $${file}) : $$(basename $${file}).html"; done >> $@
393        @echo " " >> $@
394        @echo "PHP scripts" >> $@
395        @echo "=============" >> $@
396        @for file in $(LIST_SRCPHP); do echo " ";echo "$$(basename $${file})_"; echo " "; echo ".. _$$(basename $${file}) : $$(basename $${file}).html"; done >> $@
397
398$(DIRWWW)/manuals/man/man1/%.1:$(DIRTMP)/%.rst
399        @$(RST2MAN) --input-encoding=ISO-8859-15 --strict \
400        $< $@
401
402$(DIRWWW)/manuals/html/many/%.html:$(DIRTMP)/%.rst
403        @$(RST2HTML) --input-encoding=ISO-8859-15 --strict \
404        $< $@
405
406$(DIRWWW)/manuals/pdf/many/%.pdf : $(DIRTMP)/%.tex
407        @-pdflatex -output-directory $(DIRWWW)/manuals/pdf/many/ $<
408        @-pdflatex -output-directory $(DIRWWW)/manuals/pdf/many/ $<
409
410$(DIRTMP)/%.tex : $(DIRTMP)/%.rst
411        @$(RST2LATEX) $(RST2LATEX_OPTIONS_MANY) --input-encoding=ISO-8859-15 --strict \
412        $< $@
413
414$(DIRTMP)/%.sh.rst : $(DIRSRC)/%.sh
415        @$(DIRADM)/extract_rst.sh -i $< -l sh -o $@
416
417$(DIRTMP)/%.xsl.rst : $(DIRSRC)/%.xsl
418        @$(DIRADM)/extract_rst.sh -i $< -l xml -o $@
419
420$(DIRTMP)/%.php.rst : $(DIRSRC)/%.php
421        @$(DIRADM)/extract_rst.sh -i $< -l php -o $@
422
423$(DIRDESIGN)/images/%.png : $(DIRDESIGN)/images/%.svg
424        @convert $< $@
425
426$(DIRDESIGN)/images/%.svg : $(DIRDESIGN)/%.dot
427        @dot -Tsvg -o $@ $<
428
429$(DIRDESIGN)/$(PRODUCT)_fulldependencies.dot : \
430./makefile
431        @makeppgraph --graphviz --output=$@
Note: See TracBrowser for help on using the repository browser.