source: trunk/adm/makefile @ 35

Last change on this file since 35 was 34, checked in by pinsard, 13 years ago

sphinx intermapping with cdo

  • Property svn:executable set to *
File size: 10.6 KB
Line 
1#+
2#
3# .. _makefile:
4#
5# ========
6# makefile
7# ========
8#
9# génération des manuels tropflux
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# IDL and matlab in man_troff
19#
20# pb with automodule for python path
21#
22# EVOLUTIONS
23# ==========
24#
25# - fplod 20110203T101853Z aedon.locean-ipsl.upmc.fr (Darwin)
26#
27#   * add cdo inventory file for sphinx intermapping
28#
29# - fplod 20110110T165518Z aedon.locean-ipsl.upmc.fr (Darwin)
30#
31#   * add odv files
32#
33# - fplod 20110106T135021Z aedon.locean-ipsl.upmc.fr (Darwin)
34#
35#   * add matlab, ferret files
36#
37# - fplod 20101223T083725Z aedon.locean-ipsl.upmc.fr (Darwin)
38#
39#   * add nco inventory file for sphinx intermapping
40#
41# - fplod 20101220T092552Z aedon.locean-ipsl.upmc.fr (Darwin)
42#
43#   * add saxo inventory file for sphinx intermapping
44#
45# - fplod 20101118T165524Z aedon.locean-ipsl.upmc.fr (Darwin)
46#
47#   * creation
48#
49# SEE ALSO
50# ========
51#
52# :ref:`extract_rst.sh`
53#
54#-
55#
56PRODUCT = \
57tropflux
58
59PRODUCTNAME = \
60$$(echo $(PRODUCT) | tr [:lower:] [:upper:])
61
62SUBPRODUCT = \
63tropflux_ws
64
65DIRSRC = \
66../src/
67
68DIRADM = \
69./
70
71DIRTMP = \
72./
73
74DIRDESIGN = \
75./design/
76
77DIRWWW = \
78../doc/
79
80URLPUBLISH = \
81http://www.locean-ipsl.upmc.fr/~fplod/$(PRODUCT)/$(SUBPRODUCT)/doc/
82
83LIST_INVENTORY = \
84$(DIRADM)/saxo.inv \
85$(DIRADM)/nco.inv \
86$(DIRADM)/cdo.inv
87
88LIST_RST_GUIDES = \
89$(shell find $(DIRADM)/guides/ -name "*.rst")
90
91LIST_SRCSH = \
92$(shell find $(DIRSRC) -name "*.sh" | sort)
93
94LIST_SRCSH_RST = \
95$(shell echo "$(LIST_SRCSH)" | \
96        sed -e "s+$(DIRSRC)+$(DIRTMP)/sphinx_tmpdir/manuals/+g" \
97            -e "s+\.sh+.sh.rst+g")
98
99LIST_SRCSH_TROFF = \
100$(shell echo "$(LIST_SRCSH)" | \
101        sed -e "s+$(DIRSRC)+$(DIRWWW)/man/man1/+g" \
102            -e "s+\.sh+.sh.1+g")
103
104LIST_SRCIDL = \
105$(shell find $(DIRSRC) -name "*.pro" | sort)
106
107LIST_SRCIDL_RST = \
108$(shell echo "$(LIST_SRCIDL)" | \
109        sed -e "s+$(DIRSRC)+$(DIRTMP)/sphinx_tmpdir/manuals/+g" \
110            -e "s+\.pro+.pro.rst+g")
111
112LIST_SRCMATLAB = \
113$(DIRSRC)/test/$(PRODUCT)_startup.m \
114$(DIRSRC)/test/read.m
115
116LIST_SRCMATLAB_RST = \
117$(shell echo "$(LIST_SRCMATLAB)" | \
118        sed -e "s+$(DIRSRC)/test/+$(DIRTMP)/sphinx_tmpdir/manuals/+g" \
119            -e "s+\.m+.m.rst+g")
120
121LIST_SRCFERRET = \
122$(DIRSRC)/test/read.jnl
123
124LIST_SRCFERRET_RST = \
125$(shell echo "$(LIST_SRCFERRET)" | \
126        sed -e "s+$(DIRSRC)/test/+$(DIRTMP)/sphinx_tmpdir/manuals/+g" \
127            -e "s+\.jnl+.jnl.rst+g")
128
129LIST_SRCODV = \
130$(DIRSRC)/test/read.cmd
131
132LIST_SRCODV_RST = \
133$(shell echo "$(LIST_SRCODV)" | \
134        sed -e "s+$(DIRSRC)/test/+$(DIRTMP)/sphinx_tmpdir/manuals/+g" \
135            -e "s+\.cmd+.cmd.rst+g")
136
137LIST_SRCPYTHON = \
138$(DIRSRC)/test/read.py
139
140.PHONY : \
141help \
142before \
143clean \
144cleantmp \
145design \
146htmllinkcheckb \
147htmllinkchecka \
148spellcheck \
149all \
150man \
151man_troff_sphinx \
152html \
153html_sphinx \
154html_sphinx_one \
155pdf \
156pdf_sphinx \
157html_src_browser \
158html_src_browser_doxygen
159
160help :
161        @echo "Prepare output directories :"
162        @echo "\$$ make before"
163        @echo ""
164        @echo "Following commands are available to build outputs :"
165        @echo "\$$ make all"
166        @echo " "
167        @echo "Check links before installation : "
168        @echo "\$$ make htmllinkcheckb"
169        @echo " "
170        @echo "Last step = installation of HTML and pdf files"
171        @echo "\$$ make install_all"
172        @echo " "
173        @echo "Check links after installation : "
174        @echo "\$$ make htmllinkchecka"
175        @echo " "
176
177before :
178        @mkdir -p $(DIRWWW)/man/man1/
179        @mkdir -p $(DIRWWW)/html/sphinx/
180        @mkdir -p $(DIRWWW)/pdf/sphinx/
181        @mkdir -p $(DIRTMP)/sphinx_tmpdir/doctrees/
182        @mkdir -p $(DIRTMP)/sphinx_tmpdir/manuals/
183        @mkdir -p $(DIRTMP)/sphinx_tmpdir/guides/
184        @mkdir -p $(DIRWWW)/src_browser/
185
186
187install_all : \
188install_html \
189install_pdf \
190install_browser
191
192install_html :
193        @$(DIRADM)/install.sh -w $(DIRWWW)/html/ -u $(URLPUBLISH)/html/
194
195install_pdf :
196        @$(DIRADM)/install.sh -w $(DIRWWW)/pdf/ -u $(URLPUBLISH)/pdf/
197
198install_browser :
199        @$(DIRADM)/install.sh -w $(DIRWWW)/src_browser/doxygen/html/ -u $(URLPUBLISH)/src_browser/doxygen/html/
200
201clean : \
202cleantmp
203        -@rm -fr $(DIRWWW)/man/
204        -@rm -fr $(DIRWWW)/html/
205        -@rm -fr $(DIRWWW)/pdf/
206        -@rm -fr $(DIRWWW)/src_browser/
207
208
209cleantmp :
210        -@rm -f $(DIRTMP)/all.xml
211        -@rm -f $(DIRTMP)/*.txt
212        -@rm -f $(DIRTMP)/*.tex
213        -@rm -fr $(DIRTMP)/sphinx_tmpdir/
214        -@rm -f $(DIRTMP)/sphinx_*.log
215
216design : \
217$(DIRDESIGN)/images/$(PRODUCT)_fulldependencies.png \
218$(DIRDESIGN)/images/$(PRODUCT)_fulldependencies.svg
219
220htmllinkcheckb :
221        @$(DIRADM)/linkchecker.sh -d $(DIRWWW)/html/
222
223htmllinkchecka :
224        @$(DIRADM)/linkchecker.sh -u $(URLPUBLISH)
225
226spellcheck :
227        @++aspell --mode=sgml --master=english -c \
228        $(DIRSRC)/$(PRODUCT).xml
229
230all : \
231man \
232html_src_browser
233
234html_src_browser : \
235html_src_browser_doxygen
236
237man : \
238man_troff_sphinx
239
240man_troff_sphinx : \
241$(DIRADM)/sphinx/conf.py \
242$(DIRTMP)/sphinx_tmpdir/index_manuals.rst \
243$(LIST_SRCSH_RST) \
244$(LIST_SRCIDL_RST) \
245$(LIST_SRCMATLAB_RST) \
246$(LIST_SRCFERRET_RST) \
247$(LIST_SRCODV_RST) \
248$(LIST_SRCPYTHON)
249        @sphinx-build -b man -c $(DIRADM)/sphinx \
250            -d $(DIRTMP)/sphinx_tmpdir/doctrees/ \
251            -d $(DIRTMP)/sphinx_tmpdir/doctrees/manuals/ \
252            -w $(DIRTMP)/sphinx_man_troff.log \
253            $(DIRTMP)/sphinx_tmpdir/ \
254            $(DIRWWW)/man/man1/
255
256html : \
257html_sphinx \
258html_sphinx_one
259
260html_sphinx : \
261$(DIRADM)/sphinx/conf.py \
262$(DIRADM)/index.rst \
263$(DIRADM)/index_guides.rst \
264$(DIRTMP)/sphinx_tmpdir/index_manuals.rst \
265$(LIST_INVENTORY) \
266$(LIST_RST_GUIDES) \
267$(LIST_SRCSH_RST) \
268$(LIST_SRCIDL_RST) \
269$(LIST_SRCMATLAB_RST) \
270$(LIST_SRCFERRET_RST) \
271$(LIST_SRCODV_RST) \
272$(LIST_SRCPYTHON)
273        @cp $(DIRADM)/index.rst $(DIRTMP)/sphinx_tmpdir/
274        @cp $(DIRADM)/index_guides.rst $(DIRTMP)/sphinx_tmpdir/
275        @cp $(LIST_RST_GUIDES) $(DIRTMP)/sphinx_tmpdir/guides/
276        @cp $(LIST_INVENTORY) $(DIRTMP)/sphinx_tmpdir/
277        @cp $(LIST_SRCPYTHON) $(DIRTMP)/sphinx_tmpdir/manuals/
278        @sphinx-build -b html -c $(DIRADM)/sphinx \
279            -d $(DIRTMP)/sphinx_tmpdir/doctrees \
280            -w $(DIRTMP)/sphinx_html.log \
281            $(DIRTMP)/sphinx_tmpdir/ \
282            $(DIRWWW)/html/sphinx/
283
284html_sphinx_one : \
285$(DIRADM)/sphinx/conf.py \
286$(DIRADM)/index.rst \
287$(DIRADM)/index_guides.rst \
288$(DIRTMP)/sphinx_tmpdir/index_manuals.rst \
289$(LIST_INVENTORY) \
290$(LIST_RST_GUIDES) \
291$(LIST_SRCSH_RST) \
292$(LIST_SRCIDL_RST) \
293$(LIST_SRCMATLAB_RST) \
294$(LIST_SRCFERRET_RST) \
295$(LIST_SRCODV_RST) \
296$(LIST_SRCPYTHON)
297        @cp $(DIRADM)/index.rst $(DIRTMP)/sphinx_tmpdir/
298        @cp $(DIRADM)/index_guides.rst $(DIRTMP)/sphinx_tmpdir/
299        @cp $(LIST_RST_GUIDES) $(DIRTMP)/sphinx_tmpdir/guides/
300        @cp $(LIST_INVENTORY) $(DIRTMP)/sphinx_tmpdir/
301        @sphinx-build -b singlehtml -c $(DIRADM)/sphinx \
302            -d $(DIRTMP)/sphinx_tmpdir/doctrees \
303            -w $(DIRTMP)/sphinx_html_one.log \
304            $(DIRTMP)/sphinx_tmpdir/ \
305            $(DIRWWW)/html/sphinx_one/
306
307pdf : \
308pdf_sphinx
309
310pdf_sphinx : \
311$(DIRADM)/sphinx/conf.py \
312$(DIRADM)/index.rst \
313$(DIRADM)/index_guides.rst \
314$(DIRTMP)/sphinx_tmpdir/index_manuals.rst \
315$(LIST_INVENTORY) \
316$(LIST_RST_GUIDES) \
317$(LIST_SRCSH_RST) \
318$(LIST_SRCIDL_RST) \
319$(LIST_SRCMATLAB_RST) \
320$(LIST_SRCFERRET_RST) \
321$(LIST_SRCODV_RST) \
322$(LIST_SRCPYTHONS)
323        @cp $(DIRADM)/index.rst $(DIRTMP)/sphinx_tmpdir/
324        @cp $(DIRADM)/index_guides.rst $(DIRTMP)/sphinx_tmpdir/
325        @cp $(LIST_RST_GUIDES) $(DIRTMP)/sphinx_tmpdir/guides/
326        @cp $(LIST_INVENTORY) $(DIRTMP)/sphinx_tmpdir/
327        @sphinx-build -b latex -c $(DIRADM)/sphinx \
328            -d $(DIRTMP)/sphinx_tmpdir/doctrees \
329            -w $(DIRTMP)/sphinx_pdf.log \
330            $(DIRTMP)/sphinx_tmpdir/ \
331            $(DIRTMP)/sphinx_tmpdir/latex_output
332        cd $(DIRTMP)/sphinx_tmpdir/latex_output/; make all-pdf
333        cp $(DIRTMP)/sphinx_tmpdir/latex_output/*.pdf \
334           $(DIRWWW)/pdf/sphinx/
335
336$(DIRTMP)/sphinx_tmpdir/index_manuals.rst :
337        @-mkdir $(DIRTMP)/sphinx_tmpdir/
338        @echo ".. _index_manuals:" > $@
339        @echo " " >> $@
340        @echo "$(PRODUCTNAME) manuals" | tr [:print:] = >> $@
341        @echo "$(PRODUCTNAME) manuals" >> $@
342        @echo "$(PRODUCTNAME) manuals" | tr [:print:] = >> $@
343        @echo " " >> $@
344        @echo ".. only:: html" >> $@
345        @echo " " >> $@
346        @echo "   **Download** offline version (\`.pdf <../../pdf/sphinx/$(PRODUCTNAME).pdf>\`__)" >> $@
347        @echo " " >> $@
348        @echo "Shell scripts" >> $@
349        @echo "Shell scripts" | tr [:print:] = >> $@
350        @echo ".. toctree::" >> $@
351        @echo "   :maxdepth: 1" 1>> $@
352        @echo "   :glob:" 1>> $@
353        @echo " " >> $@
354        @for file in $(LIST_SRCSH); \
355        do \
356           echo "   manuals/$$(basename $${file})"; \
357        done >> $@
358        @echo " " >> $@
359        @echo "IDL scripts" >> $@
360        @echo "IDL scripts" | tr [:print:] = >> $@
361        @echo ".. toctree::" >> $@
362        @echo "   :maxdepth: 1" 1>> $@
363        @echo "   :glob:" 1>> $@
364        @echo " " >> $@
365        @for file in $(LIST_SRCIDL); \
366        do \
367           echo "   manuals/$$(basename $${file})"; \
368        done >> $@
369        @echo " " >> $@
370        @echo "MATLAB scripts" >> $@
371        @echo "MATLAB scripts" | tr [:print:] = >> $@
372        @echo ".. toctree::" >> $@
373        @echo "   :maxdepth: 1" 1>> $@
374        @echo "   :glob:" 1>> $@
375        @echo " " >> $@
376        @for file in $(LIST_SRCMATLAB); \
377        do \
378           echo "   manuals/$$(basename $${file})"; \
379        done >> $@
380        @echo " " >> $@
381        @echo "FERRET scripts" >> $@
382        @echo "FERRET scripts" | tr [:print:] = >> $@
383        @echo ".. toctree::" >> $@
384        @echo "   :maxdepth: 1" 1>> $@
385        @echo "   :glob:" 1>> $@
386        @echo " " >> $@
387        @for file in $(LIST_SRCFERRET); \
388        do \
389           echo "   manuals/$$(basename $${file})"; \
390        done >> $@
391        @echo " " >> $@
392        @echo "ODV scripts" >> $@
393        @echo "ODV scripts" | tr [:print:] = >> $@
394        @echo ".. toctree::" >> $@
395        @echo "   :maxdepth: 1" 1>> $@
396        @echo "   :glob:" 1>> $@
397        @echo " " >> $@
398        @for file in $(LIST_SRCODV); \
399        do \
400           echo "   manuals/$$(basename $${file})"; \
401        done >> $@
402        @echo " " >> $@
403        @echo "PYTHON scripts" >> $@
404        @echo "PYTHON scripts" | tr [:print:] = >> $@
405        @echo ".. toctree::" >> $@
406        @echo "   :maxdepth: 1" 1>> $@
407        @echo "   :glob:" 1>> $@
408        @echo " " >> $@
409        @for file in $(LIST_SRCPYTHON); \
410        do \
411           echo "   .. automodule:: $$(basename $${file})"; \
412        done >> $@
413        @echo "    .. automodule::" 1>> $@
414        @echo "       :members:" 1>> $@
415        @echo " " >> $@
416
417html_src_browser_doxygen : \
418        $(DIRWWW)/src_browser/doxygen/
419
420$(DIRWWW)/src_browser/doxygen/ : \
421$(DIRADM)/Doxyfile_$(PRODUCT) \
422$(DIRADM)/m2cpp.pl \
423$(LIST_SRCFORTRAN)
424        @doxygen $<
425        @touch $@
426
427$(DIRTMP)/sphinx_tmpdir/manuals/%.sh.rst : $(DIRSRC)/%.sh $(DIRADM)/extract_rst.sh
428        @$(DIRADM)/extract_rst.sh -i $< -l sh -o $@
429
430$(DIRTMP)/sphinx_tmpdir/manuals/%.pro.rst : $(DIRSRC)/%.pro $(DIRADM)/extract_rst.sh
431        @$(DIRADM)/extract_rst.sh -i $< -l IDL -o $@
432
433$(DIRTMP)/sphinx_tmpdir/manuals/%.m.rst : $(DIRSRC)/test/%.m $(DIRADM)/extract_rst.sh
434        @$(DIRADM)/extract_rst.sh -i $< -l matlab -o $@
435
436$(DIRTMP)/sphinx_tmpdir/manuals/%.jnl.rst : $(DIRSRC)/test/%.jnl  $(DIRADM)/extract_rst.sh
437        @$(DIRADM)/extract_rst.sh -i $< -l ferret -o $@
438
439$(DIRTMP)/sphinx_tmpdir/manuals/%.cmd.rst : $(DIRSRC)/test/%.cmd  $(DIRADM)/extract_rst.sh
440        @$(DIRADM)/extract_rst.sh -i $< -l sh -o $@
441
442$(DIRDESIGN)/images/%.png : $(DIRDESIGN)/images/%.svg
443        @convert $< $@
444
445$(DIRDESIGN)/images/%.svg : $(DIRDESIGN)/%.dot
446        @dot -Tsvg -o $@ $<
447
448$(DIRDESIGN)/$(PRODUCT)_fulldependencies.dot : \
449./makefile
450        @makeppgraph --graphviz --output=$@
Note: See TracBrowser for help on using the repository browser.