source: trunk/adm/makefile @ 30

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

first plot with ferret

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