source: trunk/adm/makefile @ 104

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

no more direct usage of docutils

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