source: trunk/adm/makefile @ 20

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

sphinx intermapping with SAXO

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