source: trunk/adm/makefile @ 89

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

improve makefile dependencies

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