source: trunk/adm/makefile @ 74

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

add manuals productions using sphinx

  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 13.1 KB
Line 
1#+
2#
3# module
4# ======
5#
6# génération des manuels ircaam
7#
8# TODO
9# ====
10#
11# ++ doc executable vs doc sources (pour progfiltrage_simulation.F90)
12#
13# ++ 2 docs pour forfilter.f (filtre et kiser)
14#
15# ++ lien avec les guides
16#
17# EVOLUTIONS
18# ==========
19#
20# $Id$
21#
22# - fplod 20100325T114658Z aedon.locean-ipsl.upmc.fr (Darwin)
23#
24#   * add sphinx for HTML and PDF productions
25#   * remove html_one and pdf_one
26#
27# - fplod 20100310T111645Z aedon.locean-ipsl.upmc.fr (Darwin)
28#
29#   * add man_troff possible now with docutils 0.6
30#     can be test with
31#      $ man -M ../doc//manuals/man ircaam_profile.sh
32#
33# - fplod 2009-05-13T12:48:45Z aedon.locean-ipsl.upmc.fr (Darwin)
34#
35#   * implicit rules
36#
37#     nb : may be will only work wih GNU make
38#     but easier to update : only one line to add in thi makefile when
39#     a new file (.pro or .sh) is added in $(DIRSRC) directory
40#
41#   * rst2latex usage of manuals_many.sty and manual_one.sty (for TOC and parindent)
42#   * bug fix for PDF manual (missing one pdf2latex)
43#
44# - fplod 2009-04-03T08:01:24Z aedon.locean-ipsl.upmc.fr (Darwin)
45#
46#   * replace rst2newlatex by rst2latex and add options
47#   * suppression of rawlatex
48#   * add TOC thanks to http://docutils.sourceforge.net/docs/user/rst/demo.txt
49#
50# - fplod 2009-02-10T10:36:02Z aedon.locean-ipsl.upmc.fr (Darwin)
51#
52#   * add progfiltrage_simulation.F90, forfilter.f (new category sources fortran)
53#   * add progfiltrage_simulation.x (new category executable)++
54#
55# - fplod 2009-02-02T13:25:23Z aedon.locean-ipsl.upmc.fr (Darwin)
56#
57#   * add time_serie_eof_df.m, carte_eof_df.m, prepare_olr_filtre_simulation.m
58#
59# - fplod 2009-01-28T08:13:15Z aedon.locean-ipsl.upmc.fr (Darwin)
60#
61#   * add reconstitution_ER_rossby_df.m, time_serie_histog_phase.m,
62#     time_serie_histog_phase_num.m, composite_olr_phase.m,
63#     composite_olr_phase_num.m, composite_olr_eof_df.m,
64#     time_serie_jjas_df.m
65#
66# - fplod 2009-01-27T11:40:41Z aedon.locean-ipsl.upmc.fr (Darwin)
67#
68#   * add time_serie_ER_rossby_df.m, time_serie_ER_rossby_df_complet.m,
69#     carte_eof_ER_jjas_df.m, olr_eof_jjas2006_rossby_df.m,
70#     carte_eof234_jjas_df.m
71#
72# - fplod 2009-01-06T13:47:14Z aedon.locean-ipsl.upmc.fr (Darwin)
73#
74#   * add palette1.m palette3.m palettejerome30.m
75#
76# - fplod 2009-01-05T11:14:07Z aedon.locean-ipsl.upmc.fr (Darwin)
77#
78#   * add sauvegrads.m cartemonde.m cartemonde1.m palette.m palettecomplet.m
79#
80# - fplod 2008-12-05T11:15:37Z aedon.locean-ipsl.upmc.fr (Darwin)
81#
82#   * creation
83#
84# SEE ALSO
85# ========
86#
87# extract_rst.sh_
88#
89# .. _extract_rst.sh: ../extract_rst.sh.html
90#
91#-
92#
93PRODUCT = \
94ircaam
95
96PRODUCTNAME = \
97$$(echo $(PRODUCT) | tr [:lower:] [:upper:])
98
99SUBPRODUCT = \
100ircaam_ws
101
102DIRSRC = \
103../src/
104
105DIRADM = \
106./
107
108DIRTMP = \
109./
110
111DIRDESIGN = \
112./design/
113
114DIRWWW = \
115../doc/
116
117URLPUBLISH = \
118http://www.locean-ipsl.upmc.fr/~fplod/$(PRODUCT)/$(SUBPRODUCT)/doc/manuals/
119
120LIST_SRCSH = \
121$(DIRSRC)/$(PRODUCT)_profile.sh \
122$(DIRSRC)/dlogd.sh \
123$(DIRSRC)/elogd.sh \
124$(DIRSRC)/plogd.sh \
125$(DIRSRC)/tlogd.sh \
126$(DIRSRC)/refdataget.sh
127
128LIST_SRCSH_RST = \
129$(shell echo "$(LIST_SRCSH)" | \
130        sed -e "s+$(DIRSRC)+$(DIRTMP)+g" \
131            -e "s+\.sh+.sh.rst+g")
132
133LIST_SRCSH_TROFF = \
134$(shell echo "$(LIST_SRCSH)" | \
135        sed -e "s+$(DIRSRC)+$(DIRWWW)/manuals/man/man1/+g" \
136            -e "s+\.sh+.sh.1+g")
137
138LIST_SRCSH_HTML = \
139$(shell echo "$(LIST_SRCSH)" | \
140        sed -e "s+$(DIRSRC)+$(DIRWWW)/manuals/html/many/+g" \
141            -e "s+\.sh+.sh.html+g")
142
143LIST_SRCSH_PDF = \
144$(shell echo "$(LIST_SRCSH)" | \
145        sed -e "s+$(DIRSRC)+$(DIRWWW)/manuals/pdf/many/+g" \
146            -e "s+\.sh+.sh.pdf+g")
147
148LIST_SRCMATLAB = \
149$(DIRSRC)/$(PRODUCT)_startup.m \
150$(DIRSRC)/sauvegrads.m \
151$(DIRSRC)/cartemonde.m \
152$(DIRSRC)/cartemonde1.m \
153$(DIRSRC)/palette.m \
154$(DIRSRC)/palettecomplet.m \
155$(DIRSRC)/palette1.m \
156$(DIRSRC)/palette3.m \
157$(DIRSRC)/palettejerome30.m \
158$(DIRSRC)/mode_sahelien/time_serie_ER_rossby_df.m \
159$(DIRSRC)/mode_sahelien/time_serie_ER_rossby_df_complet.m \
160$(DIRSRC)/mode_sahelien/carte_eof_ER_jjas_df.m \
161$(DIRSRC)/mode_sahelien/olr_eof_jjas2006_rossby_df.m \
162$(DIRSRC)/mode_sahelien/carte_eof234_jjas_df.m \
163$(DIRSRC)/mode_sahelien/reconstitution_ER_rossby_df.m \
164$(DIRSRC)/mode_sahelien/time_serie_histog_phase.m \
165$(DIRSRC)/mode_sahelien/time_serie_histog_phase_num.m \
166$(DIRSRC)/mode_sahelien/composite_olr_phase.m \
167$(DIRSRC)/mode_sahelien/composite_olr_phase_num.m \
168$(DIRSRC)/mode_sahelien/composite_olr_eof_df.m \
169$(DIRSRC)/mode_sahelien/time_serie_jjas_df.m \
170$(DIRSRC)/SIMULS_IRCAAM/time_serie_eof_df.m \
171$(DIRSRC)/SIMULS_IRCAAM/carte_eof_df.m \
172$(DIRSRC)/SIMULS_IRCAAM/prepare_olr_filtre_simulation.m
173
174LIST_SRCMATLAB_RST = \
175$(shell echo "$(LIST_SRCMATLAB)" | \
176        sed -e "s+$(DIRSRC)/mode_sahelien+$(DIRTMP)+g" \
177            -e "s+$(DIRSRC)/SIMULS_IRCAAM+$(DIRTMP)+g" \
178            -e "s+$(DIRSRC)+$(DIRTMP)+g" \
179            -e "s+\.m+.m.rst+g")
180
181LIST_SRCMATLAB_HTML = \
182$(shell echo "$(LIST_SRCMATLAB)" | \
183        sed -e "s+$(DIRSRC)/mode_sahelien/+$(DIRWWW)/manuals/html/many/+g" \
184            -e "s+$(DIRSRC)/SIMULS_IRCAAM/+$(DIRWWW)/manuals/html/many/+g" \
185            -e "s+$(DIRSRC)+$(DIRWWW)/manuals/html/many/+g" \
186            -e "s+\.m+.m.html+g")
187
188LIST_SRCMATLAB_PDF = \
189$(shell echo "$(LIST_SRCMATLAB)" | \
190        sed -e "s+$(DIRSRC)/mode_sahelien/+$(DIRWWW)/manuals/pdf/many/+g" \
191            -e "s+$(DIRSRC)/SIMULS_IRCAAM/+$(DIRWWW)/manuals/pdf/many/+g" \
192            -e "s+$(DIRSRC)+$(DIRWWW)/manuals/pdf/many/+g" \
193            -e "s+\.m+.m.pdf+g")
194
195LIST_SRCFORTRAN = \
196$(DIRSRC)/SIMULS_IRCAAM/progfiltrage_simulation.F90 \
197$(DIRSRC)/forfilter.f
198
199LIST_SRCFORTRAN_RST = \
200$(shell echo "$(LIST_SRCFORTRAN)" | \
201        sed -e "s+$(DIRSRC)/SIMULS_IRCAAM/+$(DIRTMP)+g" \
202            -e "s+$(DIRSRC)+$(DIRTMP)+g" \
203            -e "s+\.F90+.F90.rst+g" \
204            -e "s+\.f+.f.rst+g")
205
206LIST_SRCFORTRAN_HTML = \
207$(shell echo "$(LIST_SRCFORTRAN)" | \
208        sed -e "s+$(DIRSRC)/SIMULS_IRCAAM/+$(DIRWWW)/manuals/html/many/+g" \
209            -e "s+$(DIRSRC)+$(DIRWWW)/manuals/html/many/+g" \
210            -e "s+\.F90+.F90.html+g" \
211            -e "s+\.f+.f.html+g")
212
213LIST_SRCFORTRAN_PDF = \
214$(shell echo "$(LIST_SRCFORTRAN)" | \
215        sed -e "s+$(DIRSRC)/mode_sahelien/+$(DIRWWW)/manuals/pdf/many/+g" \
216            -e "s+$(DIRSRC)/SIMULS_IRCAAM/+$(DIRWWW)/manuals/pdf/many/+g" \
217            -e "s+$(DIRSRC)+$(DIRWWW)/manuals/pdf/many/+g" \
218            -e "s+\.F90+.F90.pdf+g" \
219            -e "s+\.f+.f.pdf+g")
220
221RST2MAN = \
222rst2man.py
223
224RST2HTML = \
225rst2html.py
226
227RST2LATEX = \
228rst2latex.py
229
230RST2LATEX_OPTIONS_MANY = \
231--documentclass=article \
232--stylesheet=manuals_many.sty \
233--traceback \
234--use-verbatim-when-possible
235
236.PHONY : \
237help \
238before \
239clean \
240cleantmp \
241design \
242htmllinkcheckb \
243htmllinkchecka \
244spellcheck \
245all \
246man_troff \
247man_html \
248man_html_many \
249man_html_sphinx \
250man_pdf \
251man_pdf_many \
252man_pdf_sphinx
253
254help :
255        @echo "Prepare output directories :"
256        @echo "\$$ make before"
257        @echo ""
258        @echo "Following commands are available to build outputs :"
259        @echo "\$$ make all"
260        @echo " "
261        @echo "Check links before installation : "
262        @echo "\$$ make htmllinkcheckb"
263        @echo " "
264        @echo "Last step = installation of HTML and pdf files"
265        @echo "\$$ make install_all"
266        @echo " "
267        @echo "Check links after installation : "
268        @echo "\$$ make htmllinkchecka"
269        @echo " "
270
271before :
272        @mkdir -p $(DIRWWW)/manuals/man/man1/
273        @mkdir -p $(DIRWWW)/manuals/html/many/
274        @mkdir -p $(DIRWWW)/manuals/pdf/many/
275        @mkdir -p $(DIRWWW)/manuals/pdf/sphinx/
276        @mkdir -p $(DIRTMP)/sphinx_tmpdir/doctrees/
277
278install_all : \
279install_html \
280install_pdf
281
282install_html :
283        @$(DIRADM)/install.sh -w $(DIRWWW)/manuals/html/ -u $(URLPUBLISH)/html/
284
285install_pdf :
286        @$(DIRADM)/install.sh -w $(DIRWWW)/manuals/pdf/ -u $(URLPUBLISH)/pdf/
287
288clean : \
289cleantmp
290        -@rm -fr $(DIRWWW)/manuals/man/
291        -@rm -fr $(DIRWWW)/manuals/html/
292        -@rm -fr $(DIRWWW)/manuals/pdf/
293        -@rm -fr $(DIRWWW)/src_browser/
294
295cleantmp :
296        -@rm -f $(DIRTMP)/all.xml
297        -@rm -f $(DIRTMP)/*.rst
298        -@rm -f $(DIRTMP)/*.rst[12]
299        -@rm -f $(DIRTMP)/links.rst*
300        -@rm -f $(DIRTMP)/*.tex
301        -@rm -f $(DIRWWW)/manuals/pdf/many/*.aux
302        -@rm -f $(DIRWWW)/manuals/pdf/many/*.log
303        -@rm -f $(DIRWWW)/manuals/pdf/many/*.out
304        -@rm -fr $(DIRTMP)/sphinx_tmpdir/
305        -@rm -f $(DIRTMP)/sphinx_*.log
306
307design : \
308$(DIRDESIGN)/images/$(PRODUCT)_fulldependencies.png \
309$(DIRDESIGN)/images/$(PRODUCT)_fulldependencies.svg
310
311htmllinkcheckb :
312        @$(DIRADM)/linkchecker.sh -d $(DIRWWW)/manuals/html/
313
314htmllinkchecka :
315        @$(DIRADM)/linkchecker.sh -u $(URLPUBLISH)
316
317spellcheck :
318        @++aspell --mode=sgml --master=english -c \
319        $(DIRSRC)/$(PRODUCT).xml
320
321all : \
322man_troff \
323man_html \
324man_pdf
325
326man_troff : \
327$(LIST_SRCSH_TROFF)
328
329man_html : \
330man_html_many \
331man_html_sphinx
332
333man_html_many : \
334$(DIRWWW)/manuals/html/many/index.html \
335$(LIST_SRCSH_HTML) \
336$(LIST_SRCMATLAB_HTML) \
337$(LIST_SRCFORTRAN_HTML)
338
339man_html_sphinx : \
340$(DIRADM)/sphinx/conf.py \
341$(DIRTMP)/sphinx_tmpdir/index.rst \
342$(LIST_SRCSH_RST) \
343$(LIST_SRCMATLAB_RST) \
344$(LIST_SRCFORTRAN_RST)
345        @cp $(LIST_SRCSH_RST) $(DIRTMP)/sphinx_tmpdir/
346        @cp $(LIST_SRCMATLAB_RST) $(DIRTMP)/sphinx_tmpdir/
347        @cp $(LIST_SRCFORTRAN_RST) $(DIRTMP)/sphinx_tmpdir/
348        @sphinx-build -b html -c $(DIRADM)/sphinx \
349            -d $(DIRTMP)/sphinx_tmpdir/doctrees \
350            -w $(DIRTMP)/sphinx_html.log \
351            $(DIRTMP)/sphinx_tmpdir/ \
352            $(DIRWWW)/manuals/html/sphinx/
353
354man_pdf : \
355man_pdf_many \
356man_pdf_sphinx
357
358man_pdf_many : \
359$(LIST_SRCSH_PDF) \
360$(LIST_SRCMATLAB_PDF) \
361$(LIST_SRCFORTRAN_PDF)
362
363man_pdf_sphinx : \
364$(DIRADM)/sphinx/conf.py \
365$(DIRTMP)/sphinx_tmpdir/index.rst \
366$(LIST_SRCSH_PDF) \
367$(LIST_SRCMATLAB_PDF) \
368$(LIST_SRCFORTRAN_PDF)
369        @cp $(LIST_SRCSH_RST) $(DIRTMP)/sphinx_tmpdir/
370        @cp $(LIST_SRCMATLAB_RST) $(DIRTMP)/sphinx_tmpdir/
371        @cp $(LIST_SRCFORTRAN_RST) $(DIRTMP)/sphinx_tmpdir/
372        @sphinx-build -b latex -c $(DIRADM)/sphinx \
373            -d $(DIRTMP)/sphinx_tmpdir/doctrees \
374            -w $(DIRTMP)/sphinx_pdf.log \
375            $(DIRTMP)/sphinx_tmpdir/ \
376            $(DIRTMP)/sphinx_tmpdir/latex_output
377        cd $(DIRTMP)/sphinx_tmpdir/latex_output/; make all-pdf
378        cp $(DIRTMP)/sphinx_tmpdir/latex_output/*.pdf \
379           $(DIRWWW)/manuals/pdf/sphinx/
380
381$(DIRWWW)/manuals/html/many/index.html : \
382$(DIRTMP)/index_many.rst
383        @$(RST2HTML) --input-encoding=ISO-8859-15 --strict \
384        $< $@
385
386$(DIRTMP)/index_many.rst :
387        @echo "=================" >> $@
388        @echo "$(PRODUCTNAME) manuals" >> $@
389        @echo "=================" >> $@
390        @echo " " >> $@
391        @echo "Shell scripts" >> $@
392        @echo "=============" >> $@
393        @for file in $(LIST_SRCSH); \
394        do echo " "; \
395        echo ".. _$$(basename $${file}) : $$(basename $${file}).html"; \
396        echo " "; \
397        echo "- $$(basename $${file})_"; \
398        done  >> $@
399        @echo " " >> $@
400        @echo "MATLAB scripts" >> $@
401        @echo "==============" >> $@
402        @for file in $(LIST_SRCMATLAB); \
403        do echo " "; \
404        echo ".. _$$(basename $${file}) : $$(basename $${file}).html"; \
405        echo " "; \
406        echo "- $$(basename $${file})_"; \
407        done >> $@
408        @echo " " >> $@
409        @echo "Fortran Sources" >> $@
410        @echo "===============" >> $@
411        @for file in $(LIST_SRCFORTRAN); \
412        do echo " "; \
413        echo ".. _$$(basename $${file}) : $$(basename $${file}).html"; \
414        echo " "; \
415        echo "- $$(basename $${file})_"; \
416        done >> $@
417        @echo " " >> $@
418
419$(DIRTMP)/sphinx_tmpdir/index.rst :
420        @echo ".. _index:" >> $@
421        @echo " " >> $@
422        @echo "$(PRODUCTNAME) manuals" | tr [:print:] = >> $@
423        @echo "$(PRODUCTNAME) manuals" >> $@
424        @echo "$(PRODUCTNAME) manuals" | tr [:print:] = >> $@
425        @echo " " >> $@
426        @echo "Shell scripts" >> $@
427        @echo "Shell scripts" | tr [:print:] = >> $@
428        @echo ".. toctree::" >> $@
429        @echo "   :maxdepth: 1" 1>> $@
430        @echo "   :glob:" 1>> $@
431        @echo " " >> $@
432        @for file in $(LIST_SRCSH); \
433        do \
434           echo "   $$(basename $${file})"; \
435        done >> $@
436        @echo " " >> $@
437        @echo "MATLAB scripts" >> $@
438        @echo "MATLAB scripts" | tr [:print:] = >> $@
439        @echo ".. toctree::" >> $@
440        @echo "   :maxdepth: 1" 1>> $@
441        @echo "   :glob:" 1>> $@
442        @echo " " >> $@
443        @for file in $(LIST_SRCMATLAB); \
444        do \
445           echo "   $$(basename $${file})"; \
446        done >> $@
447        @echo " " >> $@
448        @echo "Fortran Sources" >> $@
449        @echo "Fortran Sources" | tr [:print:] = >> $@
450        @echo ".. toctree::" >> $@
451        @echo "   :maxdepth: 1" 1>> $@
452        @echo "   :glob:" 1>> $@
453        @echo " " >> $@
454        @for file in $(LIST_SRCFORTRAN); \
455        do \
456           echo "   $$(basename $${file})"; \
457        done >> $@
458        @echo " " >> $@
459        @echo "Indices and tables" >> $@
460        @echo "Indices and tables" | tr [:print:] = >> $@
461        @echo "* :ref:\`search\`" >> $@
462        @echo " " >> $@
463
464$(DIRWWW)/manuals/man/man1/%.1:$(DIRTMP)/%.rst
465        @$(RST2MAN) --input-encoding=ISO-8859-15 --strict \
466        $< $@
467
468$(DIRWWW)/manuals/html/many/%.html:$(DIRTMP)/%.rst
469        @$(RST2HTML) --input-encoding=ISO-8859-15 --strict \
470        $< $@
471
472$(DIRWWW)/manuals/pdf/many/%.pdf : $(DIRTMP)/%.tex
473        @-pdflatex -output-directory $(DIRWWW)/manuals/pdf/many/ $<
474        @-pdflatex -output-directory $(DIRWWW)/manuals/pdf/many/ $<
475
476$(DIRTMP)/%.tex : $(DIRTMP)/%.rst
477        @$(RST2LATEX) $(RST2LATEX_OPTIONS_MANY) --input-encoding=ISO-8859-15 --strict \
478        $< $@
479
480$(DIRTMP)/%.sh.rst : $(DIRSRC)/%.sh
481        @$(DIRADM)/extract_rst.sh -i $< -l sh -o $@
482
483$(DIRTMP)/%.m.rst : $(DIRSRC)/%.m
484        @$(DIRADM)/extract_rst.sh -i $< -l matlab -o $@
485
486$(DIRTMP)/%.m.rst : $(DIRSRC)/mode_sahelien/%.m
487        @$(DIRADM)/extract_rst.sh -i $< -l matlab -o $@
488
489$(DIRTMP)/%.m.rst : $(DIRSRC)/SIMULS_IRCAAM/%.m
490        @$(DIRADM)/extract_rst.sh -i $< -l matlab -o $@
491
492$(DIRTMP)/%.F90.rst : $(DIRSRC)/SIMULS_IRCAAM/%.F90
493        @$(DIRADM)/extract_rst.sh -i $< -l fortran -o $@
494
495$(DIRTMP)/%.f.rst : $(DIRSRC)/%.f
496        @$(DIRADM)/extract_rst.sh -i $< -l fortran -o $@
497
498$(DIRDESIGN)/images/%.png : $(DIRDESIGN)/images/%.svg
499        @convert $< $@
500
501$(DIRDESIGN)/images/%.svg : $(DIRDESIGN)/%.dot
502        @dot -Tsvg -o $@ $<
503
504$(DIRDESIGN)/$(PRODUCT)_fulldependencies.dot : \
505./makefile
506        @makeppgraph --graphviz --output=$@
Note: See TracBrowser for help on using the repository browser.