New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
makefile_compile in trunk/ADM/DOC_SCRIPTS – NEMO

source: trunk/ADM/DOC_SCRIPTS/makefile_compile @ 8624

Last change on this file since 8624 was 2520, checked in by rblod, 14 years ago

Add in core documentation for compilation scripts

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 8.0 KB
Line 
1#+
2#
3# ========
4# makefile
5# ========
6#
7# -----------------------------------------------
8# generation of documentation of NEMO compilation
9# -----------------------------------------------
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# revision of manual section of php and xsl
19#
20# EVOLUTIONS
21# ==========
22#
23# $Id$
24#
25# - fplod 20100419T145702Z aedon.locean-ipsl.upmc.fr (Darwin)
26#
27#   * remove rest2web (sphinx is prefered)
28#
29# - fplod 20100323T135104Z aedon.locean-ipsl.upmc.fr (Darwin)
30#
31#   * remove one pdf and html
32#
33# - fplod 20100311T143131Z aedon.locean-ipsl.upmc.fr (Darwin)
34#
35#   * add rest2web (alternative to sphinx)
36#
37# - fplod 20100310T190253Z aedon.locean-ipsl.upmc.fr (Darwin)
38#
39#   * add php and xsl files to man_troff
40#
41# - fplod 20100310T182201Z aedon.locean-ipsl.upmc.fr (Darwin)
42#
43#   * usage of sphinx (for the first time !) not yet ok ...
44#
45# - fplod 20100310T091541Z aedon.locean-ipsl.upmc.fr (Darwin)
46#
47#   * add man_troff with shell scripts possible now with docutils 0.6
48#     can be test with
49#      $ man -M ../doc//manuals/man bibopa.sh
50#
51# - fplod 2009-05-13T14:08:49Z aedon.locean-ipsl.upmc.fr (Darwin)
52#
53#   * implicit rules
54#
55#     nb : may be will only work wih GNU make
56#     but easier to update : only one line to add in thi makefile when
57#     a new file is added in $(DIRSRC) directory
58#
59#   * rst2latex usage of manuals_many.sty and manual_one.sty (for TOC and parindent)
60#   * bug fix for PDF manual (missing one pdf2latex)
61#
62# - fplod 2008-10-28T10:59:44Z aedon.locean-ipsl.upmc.fr (Darwin)
63#
64#   * add newpage directive
65#     (thanks to http://docutils.sourceforge.net/docs/user/latex.html)
66#
67# - fplod 2008-09-17T09:16:08Z aedon.locean-ipsl.upmc.fr (Darwin)
68#   * add xsl files
69#
70# - fplod 2008-09-16T14:59:02Z aedon.locean-ipsl.upmc.fr (Darwin)
71#   * creation
72#
73# SEE ALSO
74# ========
75#
76# extract_rst.sh_
77#
78# .. _extract_rst.sh: ../extract_rst.sh.html
79#
80#-
81#
82PRODUCT = \
83NEMO_UTIL
84
85PRODUCTNAME = \
86$$(echo $(PRODUCT) | tr [:lower:] [:upper:])
87
88DIRSRC = \
89../../NEMOGCM/TOOLS/COMPILE
90
91DIRADM = \
92./
93
94DIRTMP = \
95./
96
97DIRDESIGN = \
98./design/
99
100DIRWWW = \
101./doc/
102
103URLPUBLISH = \
104http://192.168.0.12/~rblod/$(PRODUCT)
105
106LIST_SRCSH = $(wildcard $(DIRSRC)/*.sh) \
107$(DIRSRC)/../../CONFIG/makenemo \
108$(DIRSRC)/../maketools
109
110LIST_SRCSH_RST = $(addprefix $(DIRTMP)/, $(notdir $(addsuffix .rst,$(LIST_SRCSH))))
111
112LIST_SRCSH_R2W = $(addprefix $(DIRTMP)/rest2web_tmpdir/, $(notdir $(addsuffix .txt,$(LIST_SRCSH))))
113
114LIST_SRCSH_TROFF = $(addprefix $(DIRWWW)/manuals/man/man1/, $(notdir $(addsuffix .1,$(LIST_SRCSH))))
115
116LIST_SRCSH_HTML = $(adprefix $(DIRWWW)/manuals/html/many/, $(notdir $(addsuffix .html,$(LIST_SRCSH))))
117
118LIST_SRCSH_PDF = $(addprefix $(DIRSRC)+$(DIRWWW)/manuals/pdf/many/,$(notdir $(addsuffix .pdf,$(LIST_SRCSH))))
119
120RST2MAN = \
121rst2man.py
122
123RST2HTML = \
124rst2html.py
125
126RST2LATEX = \
127rst2latex.py
128
129RST2LATEX_OPTIONS_MANY = \
130--documentclass=article \
131--stylesheet=manuals_many.sty \
132--traceback \
133--use-verbatim-when-possible
134
135.PHONY : \
136help \
137before \
138clean \
139cleantmp \
140design \
141htmllinkcheckb \
142htmllinkchecka \
143spellcheck \
144all \
145man \
146man_troff \
147man_html \
148man_html_many \
149man_html_sphinx \
150man_pdf \
151man_pdf_many \
152man_pdf_sphinx
153
154help :
155   @echo "Prepare output directories :"
156   @echo "\$$ make before"
157   @echo ""
158   @echo "Following commands are available to build outputs :"
159   @echo "\$$ make all"
160   @echo " "
161   @echo "Check links before installation : "
162   @echo "\$$ make htmllinkcheckb"
163   @echo " "
164   @echo "Last step = installation"
165   @echo "\$$ make install"
166   @echo " "
167   @echo "Check links after installation : "
168   @echo "\$$ make htmllinkchecka"
169   @echo " "
170
171before :
172   @mkdir -p $(DIRWWW)/manuals/man/man1/
173   @mkdir -p $(DIRWWW)/manuals/html/many/
174   @mkdir -p $(DIRWWW)/manuals/html/rest2web/
175   @mkdir -p $(DIRWWW)/manuals/html/rest2web/css/
176   @mkdir -p $(DIRWWW)/manuals/html/sphinx/
177   @mkdir -p $(DIRWWW)/manuals/pdf/many/
178   @mkdir -p $(DIRWWW)/manuals/pdf/sphinx/
179   @mkdir -p $(DIRTMP)/sphinx_tmpdir/doctrees/
180   @mkdir -p $(DIRTMP)/rest2web_tmpdir/
181
182install :
183   @install.sh -w $(DIRWWW) -u $(URLPUBLISH)
184
185clean : \
186cleantmp
187   -@rm -fr $(DIRWWW)/
188   -@rm -fr $(DIRWWW)/manuals/man/
189   -@rm -fr $(DIRWWW)/manuals/html/
190   -@rm -fr $(DIRWWW)/manuals/pdf/
191
192cleantmp :
193   -@rm -f $(DIRTMP)/all.xml
194   -@rm -f $(DIRTMP)/*.rst
195   -@rm -f $(DIRTMP)/*.tex
196   -@rm -rf $(DIRTMP)/rest2web_tmpdir/
197   -@rm -f $(DIRTMP)/rest2web.log
198   -@rm -f $(DIRWWW)/manuals/pdf/many/*.aux
199   -@rm -f $(DIRWWW)/manuals/pdf/many/*.log
200   -@rm -f $(DIRWWW)/manuals/pdf/many/*.out
201   -@rm -rf $(DIRTMP)/sphinx_tmpdir/
202   -@rm -f $(DIRTMP)/sphinx_*.log
203
204design : \
205$(DIRDESIGN)/images/$(PRODUCT)_fulldependencies.png \
206$(DIRDESIGN)/images/$(PRODUCT)_fulldependencies.svg
207
208htmllinkcheckb :
209   @linkchecker.sh -d $(DIRWWW)/manuals/html/
210
211htmllinkchecka :
212   @linkchecker.sh -u $(URLPUBLISH)
213
214spellcheck :
215   @++aspell --mode=sgml --master=francais -c \
216   $(DIRSRC)/$(PRODUCT).xml
217
218all : \
219SPECIAL_RST \
220man_troff \
221man_html \
222man_pdf
223
224man_troff : \
225$(LIST_SRCSH_TROFF)
226
227man_html : \
228man_html_many \
229man_html_sphinx
230
231man_html_many : \
232$(DIRWWW)/manuals/html/many/index.html \
233$(LIST_SRCSH_HTML)
234
235man_html_sphinx : \
236$(DIRADM)/sphinx/conf.py \
237$(DIRTMP)/sphinx_tmpdir/index.rst \
238$(LIST_SRCSH_RST)
239   @cp $(LIST_SRCSH_RST) $(DIRTMP)/sphinx_tmpdir/
240   sphinx-build -b html -c $(DIRADM)/sphinx \
241       -d $(DIRTMP)/sphinx_tmpdir/doctrees \
242       -w $(DIRTMP)/sphinx_html.log \
243       $(DIRTMP)/sphinx_tmpdir/ \
244       $(DIRWWW)/manuals/html/sphinx/
245
246man_pdf : \
247man_pdf_many \
248man_pdf_sphinx
249
250man_pdf_many : \
251$(LIST_SRCSH_PHP)
252
253man_pdf_sphinx : \
254$(DIRADM)/sphinx/conf.py \
255$(DIRTMP)/sphinx_tmpdir/index.rst \
256$(LIST_SRCSH_RST)
257   @cp $(LIST_SRCSH_RST) $(DIRTMP)/sphinx_tmpdir/
258   @sphinx-build -b latex -c $(DIRADM)/sphinx \
259       -d $(DIRTMP)/sphinx_tmpdir/doctrees \
260       -w $(DIRTMP)/sphinx_pdf.log \
261       $(DIRTMP)/sphinx_tmpdir/ \
262       $(DIRTMP)/sphinx_tmpdir/latex_output
263   cd $(DIRTMP)/sphinx_tmpdir/latex_output/; make all-pdf
264   cp $(DIRTMP)/sphinx_tmpdir/latex_output/*.pdf \
265      $(DIRWWW)/manuals/pdf/sphinx/
266
267$(DIRWWW)/manuals/html/many/index.html : \
268$(DIRTMP)/index_many.rst
269   @$(RST2HTML) --input-encoding=ISO-8859-15 --strict \
270   $< $@
271
272$(DIRTMP)/index_many.rst :
273   @echo "$(PRODUCTNAME) manuals" | tr [:print:] = > $@
274   @echo "$(PRODUCTNAME) manuals" >> $@
275   @echo "$(PRODUCTNAME) manuals" | tr [:print:] = >> $@
276   @echo " " >> $@
277   @echo "Shell scripts" >> $@
278   @echo "Shell scripts" | tr [:print:] = >> $@
279   @for file in $(LIST_SRCSH); do echo " ";echo "$$(basename $${file})_"; echo " "; echo ".. _$$(basename $${file}) : $$(basename $${file}).html"; done >> $@
280
281$(DIRTMP)/sphinx_tmpdir/index.rst :
282   @echo ".. _index:" >> $@
283   @echo " " >> $@
284   @echo "$(PRODUCTNAME) manuals" | tr [:print:] = >> $@
285   @echo "$(PRODUCTNAME) manuals" >> $@
286   @echo "$(PRODUCTNAME) manuals" | tr [:print:] = >> $@
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 "   $$(basename $${file})"; \
297   done >> $@
298   @echo " " >> $@
299
300$(DIRWWW)/manuals/man/man1/%.1:$(DIRTMP)/%.rst
301   @$(RST2MAN) --input-encoding=ISO-8859-15 --strict \
302   $< $@
303
304$(DIRWWW)/manuals/html/many/%.html:$(DIRTMP)/%.rst
305   @$(RST2HTML) --input-encoding=ISO-8859-15 --strict \
306   $< $@
307
308$(DIRWWW)/manuals/pdf/many/%.pdf : $(DIRTMP)/%.tex
309   @-pdflatex -output-directory $(DIRWWW)/manuals/pdf/many/ $<
310   @-pdflatex -output-directory $(DIRWWW)/manuals/pdf/many/ $<
311
312$(DIRTMP)/%.tex : $(DIRTMP)/%.rst
313   @$(RST2LATEX) $(RST2LATEX_OPTIONS_MANY) --input-encoding=ISO-8859-15 --strict \
314   $< $@
315
316$(DIRTMP)/%.sh.rst : $(DIRSRC)/%.sh
317   @$(DIRADM)/extract_rst.sh -i $< -l sh -o $@
318
319SPECIAL_RST : $(DIRTMP)/makenemo.rst $(DIRTMP)/maketools.rst
320
321$(DIRTMP)/makenemo.rst : $(DIRSRC)/../../CONFIG/makenemo
322   @$(DIRADM)/extract_rst.sh -i $< -l sh -o $@
323$(DIRTMP)/maketools.rst : $(DIRSRC)/../maketools
324   @$(DIRADM)/extract_rst.sh -i $< -l sh -o $@
325
326
327$(DIRDESIGN)/images/%.png : $(DIRDESIGN)/images/%.svg
328   @convert $< $@
329
330$(DIRDESIGN)/images/%.svg : $(DIRDESIGN)/%.dot
331   @dot -Tsvg -o $@ $<
332
333$(DIRDESIGN)/$(PRODUCT)_fulldependencies.dot : \
334./makefile
335   @makeppgraph --graphviz --output=$@
Note: See TracBrowser for help on using the repository browser.