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