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