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
RevLine 
[2]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#
[30]20# pb with automodule for python path
21#
[2]22# EVOLUTIONS
23# ==========
24#
[36]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#   
[34]31# - fplod 20110203T101853Z aedon.locean-ipsl.upmc.fr (Darwin)
32#
33#   * add cdo inventory file for sphinx intermapping
34#
[31]35# - fplod 20110110T165518Z aedon.locean-ipsl.upmc.fr (Darwin)
36#
37#   * add odv files
38#
[30]39# - fplod 20110106T135021Z aedon.locean-ipsl.upmc.fr (Darwin)
40#
41#   * add matlab, ferret files
42#
[25]43# - fplod 20101223T083725Z aedon.locean-ipsl.upmc.fr (Darwin)
44#
45#   * add nco inventory file for sphinx intermapping
46#
[20]47# - fplod 20101220T092552Z aedon.locean-ipsl.upmc.fr (Darwin)
[2]48#
[20]49#   * add saxo inventory file for sphinx intermapping
50#
[2]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
[36]83DIRWWW_DEV = \
[2]84../doc/
85
[36]86DIRWWW_USER = \
87./website/_build/
88
89URLPUBLISH_DEV = \
[2]90http://www.locean-ipsl.upmc.fr/~fplod/$(PRODUCT)/$(SUBPRODUCT)/doc/
91
[36]92URLPUBLISH_USER = \
93http://www.locean-ipsl.upmc.fr/~tropflux
94
[20]95LIST_INVENTORY = \
[25]96$(DIRADM)/saxo.inv \
[34]97$(DIRADM)/nco.inv \
98$(DIRADM)/cdo.inv
[20]99
[2]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)" | \
[36]113        sed -e "s+$(DIRSRC)+$(DIRWWW_DEV)/man/man1/+g" \
[2]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
[30]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
[31]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
[30]149LIST_SRCPYTHON = \
150$(DIRSRC)/test/read.py
151
[2]152.PHONY : \
153help \
154before \
155clean \
156cleantmp \
157design \
158htmllinkcheckb \
159htmllinkchecka \
160spellcheck \
161all \
162man \
163man_troff_sphinx \
164html \
[36]165html_dev \
166html_dev_sphinx \
167html_user \
[2]168pdf \
[36]169pdf_dev \
170pdf_dev_sphinx \
171pdf_user \
[2]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 :
[36]193        @mkdir -p $(DIRWWW_DEV)/man/man1/
194        @mkdir -p $(DIRWWW_DEV)/html/sphinx/
195        @mkdir -p $(DIRWWW_DEV)/pdf/sphinx/
[2]196        @mkdir -p $(DIRTMP)/sphinx_tmpdir/doctrees/
197        @mkdir -p $(DIRTMP)/sphinx_tmpdir/manuals/
198        @mkdir -p $(DIRTMP)/sphinx_tmpdir/guides/
[36]199        @mkdir -p $(DIRWWW_DEV)/src_browser/
[2]200
201
202install_all : \
[36]203install_html_dev \
204install_html_user \
205install_pdf_dev \
206install_pdf_user \
[2]207install_browser
208
[36]209install_html_dev :
210        @$(DIRADM)/install.sh -w $(DIRWWW_DEV)/html/ -u $(URLPUBLISH_DEV)/html/
[2]211
[36]212install_html_user :
213        @$(DIRADM)/install.sh -w $(DIRWWW_USER)/ -u $(URLPUBLISH_USER)/
[2]214
[36]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
[2]221install_browser :
[36]222        @$(DIRADM)/install.sh -w $(DIRWWW_DEV)/src_browser/doxygen/html/ -u $(URLPUBLISH_DEV)/src_browser/doxygen/html/
[2]223
224clean : \
225cleantmp
[36]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
[2]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 :
[36]245        @$(DIRADM)/linkchecker.sh -d $(DIRWWW_DEV)/html/
246        @$(DIRADM)/linkchecker.sh -d $(DIRWWW_USER)
[2]247
248htmllinkchecka :
[36]249        @$(DIRADM)/linkchecker.sh -u $(URLPUBLISH_DEV)
250        @$(DIRADM)/linkchecker.sh -u $(URLPUBLISH_USER)
[2]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) \
[30]270$(LIST_SRCIDL_RST) \
271$(LIST_SRCMATLAB_RST) \
272$(LIST_SRCFERRET_RST) \
[31]273$(LIST_SRCODV_RST) \
[30]274$(LIST_SRCPYTHON)
[2]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/ \
[36]280            $(DIRWWW_DEV)/man/man1/
[2]281
282html : \
[36]283html_user \
284html_dev
[2]285
[36]286html_user :
287        cd $(DIRADM)/website/; make html
288
289html_dev : \
290html_dev_sphinx \
291html_dev_sphinx_one
292
293html_dev_sphinx : \
[2]294$(DIRADM)/sphinx/conf.py \
295$(DIRADM)/index.rst \
296$(DIRADM)/index_guides.rst \
297$(DIRTMP)/sphinx_tmpdir/index_manuals.rst \
[20]298$(LIST_INVENTORY) \
[2]299$(LIST_RST_GUIDES) \
300$(LIST_SRCSH_RST) \
[30]301$(LIST_SRCIDL_RST) \
302$(LIST_SRCMATLAB_RST) \
303$(LIST_SRCFERRET_RST) \
[31]304$(LIST_SRCODV_RST) \
[30]305$(LIST_SRCPYTHON)
[2]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/
[20]309        @cp $(LIST_INVENTORY) $(DIRTMP)/sphinx_tmpdir/
[30]310        @cp $(LIST_SRCPYTHON) $(DIRTMP)/sphinx_tmpdir/manuals/
[2]311        @sphinx-build -b html -c $(DIRADM)/sphinx \
312            -d $(DIRTMP)/sphinx_tmpdir/doctrees \
313            -w $(DIRTMP)/sphinx_html.log \
314            $(DIRTMP)/sphinx_tmpdir/ \
[36]315            $(DIRWWW_DEV)/html/sphinx/
[2]316
[36]317html_dev_sphinx_one : \
[2]318$(DIRADM)/sphinx/conf.py \
319$(DIRADM)/index.rst \
320$(DIRADM)/index_guides.rst \
321$(DIRTMP)/sphinx_tmpdir/index_manuals.rst \
[20]322$(LIST_INVENTORY) \
[2]323$(LIST_RST_GUIDES) \
324$(LIST_SRCSH_RST) \
[30]325$(LIST_SRCIDL_RST) \
326$(LIST_SRCMATLAB_RST) \
327$(LIST_SRCFERRET_RST) \
[31]328$(LIST_SRCODV_RST) \
[30]329$(LIST_SRCPYTHON)
[2]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/
[20]333        @cp $(LIST_INVENTORY) $(DIRTMP)/sphinx_tmpdir/
[2]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/ \
[36]338            $(DIRWWW_DEV)/html/sphinx_one/
[2]339
340pdf : \
[36]341pdf_user \
342pdf_dev
[2]343
[36]344pdf_user :
345        cd $(DIRADM)/website/
346        make pdf
347
348pdf_dev : \
349pdf_dev_sphinx
350
351pdf_dev_sphinx : \
[2]352$(DIRADM)/sphinx/conf.py \
353$(DIRADM)/index.rst \
354$(DIRADM)/index_guides.rst \
355$(DIRTMP)/sphinx_tmpdir/index_manuals.rst \
[20]356$(LIST_INVENTORY) \
[2]357$(LIST_RST_GUIDES) \
358$(LIST_SRCSH_RST) \
[30]359$(LIST_SRCIDL_RST) \
360$(LIST_SRCMATLAB_RST) \
361$(LIST_SRCFERRET_RST) \
[31]362$(LIST_SRCODV_RST) \
[30]363$(LIST_SRCPYTHONS)
[2]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/
[20]367        @cp $(LIST_INVENTORY) $(DIRTMP)/sphinx_tmpdir/
[2]368        @sphinx-build -b latex -c $(DIRADM)/sphinx \
369            -d $(DIRTMP)/sphinx_tmpdir/doctrees \
[36]370            -w $(DIRTMP)/sphinx_pdf_dev.log \
[2]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 \
[36]375           $(DIRWWW_DEV)/pdf/sphinx/
[2]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 " " >> $@
[30]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 " " >> $@
[31]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 " " >> $@
[30]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 " " >> $@
[2]457
458html_src_browser_doxygen : \
[36]459        $(DIRWWW_DEV)/src_browser/doxygen/
[2]460
[36]461$(DIRWWW_DEV)/src_browser/doxygen/ : \
[2]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
[30]474$(DIRTMP)/sphinx_tmpdir/manuals/%.m.rst : $(DIRSRC)/test/%.m $(DIRADM)/extract_rst.sh
[2]475        @$(DIRADM)/extract_rst.sh -i $< -l matlab -o $@
476
[30]477$(DIRTMP)/sphinx_tmpdir/manuals/%.jnl.rst : $(DIRSRC)/test/%.jnl  $(DIRADM)/extract_rst.sh
[2]478        @$(DIRADM)/extract_rst.sh -i $< -l ferret -o $@
479
[31]480$(DIRTMP)/sphinx_tmpdir/manuals/%.cmd.rst : $(DIRSRC)/test/%.cmd  $(DIRADM)/extract_rst.sh
481        @$(DIRADM)/extract_rst.sh -i $< -l sh -o $@
482
[2]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.