source: trunk/adm/makefile @ 2

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

first commit with original work of Francoise Pinsard

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