source: trunk/adm/makefile @ 4

Last change on this file since 4 was 4, checked in by pinsard, 15 years ago

administration subset : sources and tools for manuals

  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 8.4 KB
Line 
1#+
2#
3# module
4# ======
5#
6# génération des manuels
7#
8# TODO
9# ====
10#
11# ++ lien avec les guides
12#
13# EVOLUTIONS
14# ==========
15#
16# $Id$
17#
18# - fplod 2009-08-21T10:32:47Z aedon.locean-ipsl.upmc.fr (Darwin)
19#
20#   * creation
21#
22# SEE ALSO
23# ========
24#
25# extract_rst.sh_
26#
27# .. _extract_rst.sh: ../extract_rst.sh.html
28#
29#-
30#
31PRODUCT = \
32tpacpandreg
33
34PRODUCTNAME = \
35$$(echo $(PRODUCT) | tr [:lower:] [:upper:])
36
37SUBPRODUCT = \
38tpacpandreg_ws
39
40DIRSRC = \
41../
42
43DIRADM = \
44./
45
46DIRTMP = \
47./
48
49DIRWWW = \
50../doc/
51
52URLPUBLISH = \
53http://www.locean-ipsl.upmc.fr/~fplod/$(PRODUCT)/$(SUBPRODUCT)/doc/manuals/
54
55LIST_SRCSH =
56
57LIST_SRCSH_RST = \
58$(shell echo "$(LIST_SRCSH)" | \
59        sed -e "s+$(DIRSRC)/PROGRAMMES/+$(DIRTMP)+g" \
60            -e "s+\.sh+.sh.rst+g")
61
62LIST_SRCSH_HTML = \
63$(shell echo "$(LIST_SRCSH)" | \
64        sed -e "s+$(DIRSRC)/PROGRAMMES/+$(DIRWWW)/manuals/html/many/+g" \
65            -e "s+\.sh+.sh.html+g")
66
67LIST_SRCSH_PDF = \
68$(shell echo "$(LIST_SRCSH)" | \
69        sed -e "s+$(DIRSRC)/PROGRAMMES/+$(DIRWWW)/manuals/pdf/many/+g" \
70            -e "s+\.sh+.sh.pdf+g")
71
72LIST_SRCMATLAB = \
73$(DIRSRC)/PROGRAMMES/$(PRODUCT)_startup.m
74
75LIST_SRCMATLAB_RST = \
76$(shell echo "$(LIST_SRCMATLAB)" | \
77        sed -e "s+$(DIRSRC)/PROGRAMMES/+$(DIRTMP)+g" \
78            -e "s+$(DIRSRC)/RESULTATS/+$(DIRTMP)+g" \
79            -e "s+\.m+.m.rst+g")
80
81LIST_SRCMATLAB_HTML = \
82$(shell echo "$(LIST_SRCMATLAB)" | \
83        sed -e "s+$(DIRSRC)/PROGRAMMES/+$(DIRWWW)/manuals/html/many/+g" \
84            -e "s+$(DIRSRC)/RESULTATS/+$(DIRWWW)/manuals/html/many/+g" \
85            -e "s+\.m+.m.html+g")
86
87LIST_SRCMATLAB_PDF = \
88$(shell echo "$(LIST_SRCMATLAB)" | \
89        sed -e "s+$(DIRSRC)/PROGRAMMES/+$(DIRWWW)/manuals/pdf/many/+g" \
90            -e "s+$(DIRSRC)/RESULTATS/+$(DIRWWW)/manuals/pdf/many/+g" \
91            -e "s+\.m+.m.pdf+g")
92
93RST2HTML = \
94rst2html
95
96RST2LATEX = \
97rst2latex
98
99RST2LATEX_OPTIONS_ONE = \
100--documentclass=book \
101--stylesheet=manual_one.sty \
102--use-latex-toc \
103--section-numbering \
104--traceback \
105--use-verbatim-when-possible
106
107RST2LATEX_OPTIONS_MANY = \
108--documentclass=article \
109--stylesheet=manuals_many.sty \
110--traceback \
111--use-verbatim-when-possible
112
113.PHONY : \
114help \
115before \
116clean \
117htmllinkcheckb \
118htmllinkchecka \
119spellcheck \
120all \
121html \
122pdf
123
124help :
125        @echo "Prepare output directories :"
126        @echo "\$$ make before"
127        @echo ""
128        @echo "Following commands are available to build outputs :"
129        @echo "\$$ make all"
130        @echo " "
131        @echo "Check links before installation : "
132        @echo "\$$ make htmllinkcheckb"
133        @echo " "
134        @echo "Last step = installation of HTML and pdf files"
135        @echo "\$$ make install_all"
136        @echo " "
137        @echo "Check links after installation : "
138        @echo "\$$ make htmllinkchecka"
139        @echo " "
140
141before :
142        @mkdir -p $(DIRWWW)/manuals/html/one/
143        @mkdir -p $(DIRWWW)/manuals/html/many/
144        @mkdir -p $(DIRWWW)/manuals/pdf/one/
145        @mkdir -p $(DIRWWW)/manuals/pdf/many/
146
147install_all : \
148install_html \
149install_pdf
150
151install_html :
152        @$(DIRADM)/install.sh -w $(DIRWWW)/manuals/html/ -u $(URLPUBLISH)/html/
153
154install_pdf :
155        @$(DIRADM)/install.sh -w $(DIRWWW)/manuals/pdf/ -u $(URLPUBLISH)/pdf/
156
157clean : \
158cleantmp
159        -@rm -fr $(DIRWWW)/manuals/html/
160        -@rm -fr $(DIRWWW)/manuals/pdf/
161        -@rm -fr $(DIRWWW)/src_browser/
162
163cleantmp :
164        -@rm -f $(DIRTMP)/all.xml
165        -@rm -f $(DIRTMP)/*.rst
166        -@rm -f $(DIRTMP)/*.rst[12]
167        -@rm -f $(DIRTMP)/links.rst*
168        -@rm -f $(DIRTMP)/*.tex
169        -@rm -f $(DIRWWW)/manuals/pdf/one/*.aux
170        -@rm -f $(DIRWWW)/manuals/pdf/one/*.log
171        -@rm -f $(DIRWWW)/manuals/pdf/one/*.out
172        -@rm -f $(DIRWWW)/manuals/pdf/many/*.aux
173        -@rm -f $(DIRWWW)/manuals/pdf/many/*.log
174        -@rm -f $(DIRWWW)/manuals/pdf/many/*.out
175
176htmllinkcheckb :
177        @$(DIRADM)/linkchecker.sh -d $(DIRWWW)/manuals/html/
178
179htmllinkchecka :
180        @$(DIRADM)/linkchecker.sh -u $(URLPUBLISH)
181
182spellcheck :
183        @++aspell --mode=sgml --master=english -c \
184        $(DIRSRC)/$(PRODUCT).xml
185
186all : \
187man_html \
188man_pdf
189
190man_html : \
191man_html_one \
192man_html_many
193
194man_html_one : \
195$(DIRWWW)/manuals/html/one/index.html
196
197man_html_many : \
198$(DIRWWW)/manuals/html/many/index.html \
199$(LIST_SRCSH_HTML) \
200$(LIST_SRCMATLAB_HTML)
201
202man_pdf : \
203man_pdf_one \
204man_pdf_many
205
206man_pdf_one : \
207$(DIRWWW)/manuals/pdf/one/$(PRODUCT)_manuals.pdf \
208
209man_pdf_many : \
210$(LIST_SRCSH_PDF) \
211$(LIST_SRCMATLAB_PDF)
212
213$(DIRWWW)/manuals/html/many/index.html : \
214$(DIRTMP)/index_many.rst
215        @$(RST2HTML) --input-encoding=ISO-8859-15 --strict \
216        $< $@
217
218$(DIRWWW)/manuals/html/one/index.html : \
219$(DIRTMP)/$(PRODUCT)_manuals.rst
220        @$(RST2HTML) --input-encoding=ISO-8859-15 --strict \
221        $< $@
222
223$(DIRWWW)/manuals/pdf/one/$(PRODUCT)_manuals.pdf : \
224$(DIRTMP)/$(PRODUCT)_manuals.tex
225        @-pdflatex -output-directory $(DIRWWW)/manuals/pdf/one/ $<
226        @-pdflatex -output-directory $(DIRWWW)/manuals/pdf/one/ $<
227
228$(DIRTMP)/$(PRODUCT)_manuals.tex : \
229$(DIRTMP)/$(PRODUCT)_manuals.rst
230        @$(RST2LATEX) $(RST2LATEX_OPTIONS_ONE) --input-encoding=ISO-8859-15 --strict \
231        $< $@
232
233$(DIRTMP)/$(PRODUCT)_manuals.rst : \
234$(DIRTMP)/index_one.rst \
235$(LIST_SRCSH_RST) \
236$(LIST_SRCMATLAB_RST)
237        echo "$(LIST_SRCMATLAB_RST)"
238        @cat $(DIRTMP)/index_one.rst > ${DIRTMP}/$(PRODUCT)_manuals.rst1
239        @echo "Shell scripts" >> ${DIRTMP}/$(PRODUCT)_manuals.rst1
240        @echo "=============" >> ${DIRTMP}/$(PRODUCT)_manuals.rst1
241        @for file in $(LIST_SRCSH); \
242        do echo " " >> ${DIRTMP}/$(PRODUCT)_manuals.rst1; \
243         echo " " >> ${DIRTMP}/$(PRODUCT)_manuals.rst1; \
244         echo ".. _$$(basename $${file}) :" >> ${DIRTMP}/$(PRODUCT)_manuals.rst1; \
245         echo " " >> ${DIRTMP}/$(PRODUCT)_manuals.rst1; \
246         echo "$$(basename $${file})" >> ${DIRTMP}/$(PRODUCT)_manuals.rst1; \
247         echo "$$(basename $${file} | tr [:print:] -)" >> ${DIRTMP}/$(PRODUCT)_manuals.rst1 ; \
248         echo " " >> ${DIRTMP}/$(PRODUCT)_manuals.rst1; \
249         sed -e "s/^==*$$/-----------------/" \
250        -e "s/^--*$$/~~~~~~~~~~~~~~~~~~~~/" \
251         ${DIRTMP}/$$(basename $${file}).rst >> ${DIRTMP}/$(PRODUCT)_manuals.rst1; \
252        done
253        @echo "MATLAB scripts" >> ${DIRTMP}/$(PRODUCT)_manuals.rst1
254        @echo "==============" >> ${DIRTMP}/$(PRODUCT)_manuals.rst1
255        @for file in $(LIST_SRCMATLAB); \
256        do echo " " >> ${DIRTMP}/$(PRODUCT)_manuals.rst1; \
257         echo " " >> ${DIRTMP}/$(PRODUCT)_manuals.rst1; \
258         echo ".. _$$(basename $${file}) :" >> ${DIRTMP}/$(PRODUCT)_manuals.rst1; \
259         echo " " >> ${DIRTMP}/$(PRODUCT)_manuals.rst1; \
260         echo "$$(basename $${file})" >> ${DIRTMP}/$(PRODUCT)_manuals.rst1; \
261         echo "$$(basename $${file} | tr [:print:] -)" >> ${DIRTMP}/$(PRODUCT)_manuals.rst1 ; \
262         echo " " >> ${DIRTMP}/$(PRODUCT)_manuals.rst1; \
263         sed -e "s/^==*$$/-----------------/" \
264         -e "s/^--*$$/~~~~~~~~~~~~~~~~~~~~/" \
265         ${DIRTMP}/$$(basename $${file}).rst >> ${DIRTMP}/$(PRODUCT)_manuals.rst1; \
266        done
267        @grep "\.\. _.*: .*$$" ${DIRTMP}/$(PRODUCT)_manuals.rst1 > \
268        ${DIRTMP}/links.rst
269        @sed -e "s/^ *//" ${DIRTMP}/links.rst | sort -u > ${DIRTMP}/links.rst2
270        @sed -e "/\.\. _.*: .*$$/d" ${DIRTMP}/$(PRODUCT)_manuals.rst1 > \
271        ${DIRTMP}/$(PRODUCT)_manuals.rst2
272        @cp ${DIRTMP}/$(PRODUCT)_manuals.rst2 $@
273
274$(DIRTMP)/index_one.rst :
275        @echo "$(PRODUCTNAME) manuals" | tr [:print:] = >> $@
276        @echo "$(PRODUCTNAME) manuals" >> $@
277        @echo "$(PRODUCTNAME) manuals" | tr [:print:] = >> $@
278        @echo " " >> $@
279        @echo ".. contents:: Table of Contents" >> $@
280        @echo "  :depth: 2" >> $@
281        @echo ".. section-numbering::" >> $@
282        @echo " " >> $@
283
284$(DIRTMP)/index_many.rst :
285        @echo "$(PRODUCTNAME) manuals" | tr [:print:] = >> $@
286        @echo "$(PRODUCTNAME) manuals" >> $@
287        @echo "$(PRODUCTNAME) manuals" | tr [:print:] = >> $@
288        @echo " " >> $@
289        @echo "Shell scripts" >> $@
290        @echo "=============" >> $@
291        @for file in $(LIST_SRCSH); \
292        do echo " "; \
293        echo ".. _$$(basename $${file}) : $$(basename $${file}).html"; \
294        echo " "; \
295        echo "- $$(basename $${file})_"; \
296        done  >> $@
297        @echo " " >> $@
298        @echo "MATLAB scripts" >> $@
299        @echo "==============" >> $@
300        @for file in $(LIST_SRCMATLAB); \
301        do echo " "; \
302        echo ".. _$$(basename $${file}) : $$(basename $${file}).html"; \
303        echo " "; \
304        echo "- $$(basename $${file})_"; \
305        done >> $@
306        @echo " " >> $@
307
308$(DIRWWW)/manuals/html/many/%.html:$(DIRTMP)/%.rst
309        @$(RST2HTML) --input-encoding=ISO-8859-15 --strict \
310        $< $@
311
312$(DIRWWW)/manuals/pdf/many/%.pdf : $(DIRTMP)/%.tex
313        @-pdflatex -output-directory $(DIRWWW)/manuals/pdf/many/ $<
314        @-pdflatex -output-directory $(DIRWWW)/manuals/pdf/many/ $<
315
316$(DIRTMP)/%.tex : $(DIRTMP)/%.rst
317        @$(RST2LATEX) $(RST2LATEX_OPTIONS_MANY) --input-encoding=ISO-8859-15 --strict \
318        $< $@
319
320$(DIRTMP)/%.sh.rst : $(DIRSRC)/PROGRAMMES/%.sh
321        @$(DIRADM)/extract_rst.sh -i $< -l sh -o $@
322
323$(DIRTMP)/%.m.rst : $(DIRSRC)/PROGRAMMES/%.m
324        @$(DIRADM)/extract_rst.sh -i $< -l matlab -o $@
325
326$(DIRTMP)/%.m.rst : $(DIRSRC)/RESULTATS/%.m
327        @$(DIRADM)/extract_rst.sh -i $< -l matlab -o $@
Note: See TracBrowser for help on using the repository browser.