source: trunk/adm/makefile @ 25

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

sphinx intermapping with NCO

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