source: trunk/adm/makefile @ 36

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

add end users website production

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