[2246] | 1 | #+ |
---|
| 2 | # |
---|
| 3 | # ======== |
---|
| 4 | # makefile |
---|
| 5 | # ======== |
---|
| 6 | # |
---|
[2520] | 7 | # ----------------------------------------------- |
---|
| 8 | # generation of documentation of NEMO compilation |
---|
| 9 | # ----------------------------------------------- |
---|
[2246] | 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 | # |
---|
[8730] | 23 | # $Id: makefile_compile 2520 2010-12-27 14:43:36Z rblod $ |
---|
[2246] | 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 | # |
---|
| 82 | PRODUCT = \ |
---|
| 83 | NEMO_UTIL |
---|
| 84 | |
---|
| 85 | PRODUCTNAME = \ |
---|
| 86 | $$(echo $(PRODUCT) | tr [:lower:] [:upper:]) |
---|
| 87 | |
---|
| 88 | DIRSRC = \ |
---|
| 89 | ../../NEMOGCM/TOOLS/COMPILE |
---|
| 90 | |
---|
| 91 | DIRADM = \ |
---|
| 92 | ./ |
---|
| 93 | |
---|
| 94 | DIRTMP = \ |
---|
| 95 | ./ |
---|
| 96 | |
---|
| 97 | DIRDESIGN = \ |
---|
| 98 | ./design/ |
---|
| 99 | |
---|
| 100 | DIRWWW = \ |
---|
| 101 | ./doc/ |
---|
| 102 | |
---|
| 103 | URLPUBLISH = \ |
---|
| 104 | http://192.168.0.12/~rblod/$(PRODUCT) |
---|
| 105 | |
---|
| 106 | LIST_SRCSH = $(wildcard $(DIRSRC)/*.sh) \ |
---|
| 107 | $(DIRSRC)/../../CONFIG/makenemo \ |
---|
| 108 | $(DIRSRC)/../maketools |
---|
| 109 | |
---|
| 110 | LIST_SRCSH_RST = $(addprefix $(DIRTMP)/, $(notdir $(addsuffix .rst,$(LIST_SRCSH)))) |
---|
| 111 | |
---|
| 112 | LIST_SRCSH_R2W = $(addprefix $(DIRTMP)/rest2web_tmpdir/, $(notdir $(addsuffix .txt,$(LIST_SRCSH)))) |
---|
| 113 | |
---|
| 114 | LIST_SRCSH_TROFF = $(addprefix $(DIRWWW)/manuals/man/man1/, $(notdir $(addsuffix .1,$(LIST_SRCSH)))) |
---|
| 115 | |
---|
| 116 | LIST_SRCSH_HTML = $(adprefix $(DIRWWW)/manuals/html/many/, $(notdir $(addsuffix .html,$(LIST_SRCSH)))) |
---|
| 117 | |
---|
| 118 | LIST_SRCSH_PDF = $(addprefix $(DIRSRC)+$(DIRWWW)/manuals/pdf/many/,$(notdir $(addsuffix .pdf,$(LIST_SRCSH)))) |
---|
| 119 | |
---|
| 120 | RST2MAN = \ |
---|
| 121 | rst2man.py |
---|
| 122 | |
---|
| 123 | RST2HTML = \ |
---|
| 124 | rst2html.py |
---|
| 125 | |
---|
| 126 | RST2LATEX = \ |
---|
| 127 | rst2latex.py |
---|
| 128 | |
---|
| 129 | RST2LATEX_OPTIONS_MANY = \ |
---|
| 130 | --documentclass=article \ |
---|
| 131 | --stylesheet=manuals_many.sty \ |
---|
| 132 | --traceback \ |
---|
| 133 | --use-verbatim-when-possible |
---|
| 134 | |
---|
| 135 | .PHONY : \ |
---|
| 136 | help \ |
---|
| 137 | before \ |
---|
| 138 | clean \ |
---|
| 139 | cleantmp \ |
---|
| 140 | design \ |
---|
| 141 | htmllinkcheckb \ |
---|
| 142 | htmllinkchecka \ |
---|
| 143 | spellcheck \ |
---|
| 144 | all \ |
---|
| 145 | man \ |
---|
| 146 | man_troff \ |
---|
| 147 | man_html \ |
---|
| 148 | man_html_many \ |
---|
| 149 | man_html_sphinx \ |
---|
| 150 | man_pdf \ |
---|
| 151 | man_pdf_many \ |
---|
| 152 | man_pdf_sphinx |
---|
| 153 | |
---|
| 154 | help : |
---|
| 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 | |
---|
| 171 | before : |
---|
| 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 | |
---|
| 182 | install : |
---|
| 183 | @install.sh -w $(DIRWWW) -u $(URLPUBLISH) |
---|
| 184 | |
---|
| 185 | clean : \ |
---|
| 186 | cleantmp |
---|
| 187 | -@rm -fr $(DIRWWW)/ |
---|
| 188 | -@rm -fr $(DIRWWW)/manuals/man/ |
---|
| 189 | -@rm -fr $(DIRWWW)/manuals/html/ |
---|
| 190 | -@rm -fr $(DIRWWW)/manuals/pdf/ |
---|
| 191 | |
---|
| 192 | cleantmp : |
---|
| 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 | |
---|
| 204 | design : \ |
---|
| 205 | $(DIRDESIGN)/images/$(PRODUCT)_fulldependencies.png \ |
---|
| 206 | $(DIRDESIGN)/images/$(PRODUCT)_fulldependencies.svg |
---|
| 207 | |
---|
| 208 | htmllinkcheckb : |
---|
| 209 | @linkchecker.sh -d $(DIRWWW)/manuals/html/ |
---|
| 210 | |
---|
| 211 | htmllinkchecka : |
---|
| 212 | @linkchecker.sh -u $(URLPUBLISH) |
---|
| 213 | |
---|
| 214 | spellcheck : |
---|
| 215 | @++aspell --mode=sgml --master=francais -c \ |
---|
| 216 | $(DIRSRC)/$(PRODUCT).xml |
---|
| 217 | |
---|
| 218 | all : \ |
---|
| 219 | SPECIAL_RST \ |
---|
| 220 | man_troff \ |
---|
| 221 | man_html \ |
---|
| 222 | man_pdf |
---|
| 223 | |
---|
| 224 | man_troff : \ |
---|
| 225 | $(LIST_SRCSH_TROFF) |
---|
| 226 | |
---|
| 227 | man_html : \ |
---|
| 228 | man_html_many \ |
---|
| 229 | man_html_sphinx |
---|
| 230 | |
---|
| 231 | man_html_many : \ |
---|
| 232 | $(DIRWWW)/manuals/html/many/index.html \ |
---|
| 233 | $(LIST_SRCSH_HTML) |
---|
| 234 | |
---|
| 235 | man_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 | |
---|
| 246 | man_pdf : \ |
---|
| 247 | man_pdf_many \ |
---|
| 248 | man_pdf_sphinx |
---|
| 249 | |
---|
| 250 | man_pdf_many : \ |
---|
| 251 | $(LIST_SRCSH_PHP) |
---|
| 252 | |
---|
| 253 | man_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 | |
---|
| 319 | SPECIAL_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=$@ |
---|