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