source: trunk/adm/makefile @ 31

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

improve rest headers thanks to sphinx update (1.0.4 to 1.0.7)

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