source: trunk/adm/makefile @ 101

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

improve environnement definition

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