#+ # # module # ====== # # génération des manuels # # TODO # ==== # # ++ lien avec les guides # # EVOLUTIONS # ========== # # $Id$ # # - fplod 2009-08-21T10:32:47Z aedon.locean-ipsl.upmc.fr (Darwin) # # * creation # # SEE ALSO # ======== # # extract_rst.sh_ # # .. _extract_rst.sh: ../extract_rst.sh.html # #- # PRODUCT = \ tpacpandreg PRODUCTNAME = \ $$(echo $(PRODUCT) | tr [:lower:] [:upper:]) SUBPRODUCT = \ tpacpandreg_ws DIRSRC = \ ../ DIRADM = \ ./ DIRTMP = \ ./ DIRWWW = \ ../doc/ URLPUBLISH = \ http://www.locean-ipsl.upmc.fr/~fplod/$(PRODUCT)/$(SUBPRODUCT)/doc/manuals/ LIST_SRCSH = LIST_SRCSH_RST = \ $(shell echo "$(LIST_SRCSH)" | \ sed -e "s+$(DIRSRC)/PROGRAMMES/+$(DIRTMP)+g" \ -e "s+\.sh+.sh.rst+g") LIST_SRCSH_HTML = \ $(shell echo "$(LIST_SRCSH)" | \ sed -e "s+$(DIRSRC)/PROGRAMMES/+$(DIRWWW)/manuals/html/many/+g" \ -e "s+\.sh+.sh.html+g") LIST_SRCSH_PDF = \ $(shell echo "$(LIST_SRCSH)" | \ sed -e "s+$(DIRSRC)/PROGRAMMES/+$(DIRWWW)/manuals/pdf/many/+g" \ -e "s+\.sh+.sh.pdf+g") LIST_SRCMATLAB = \ $(DIRSRC)/PROGRAMMES/$(PRODUCT)_startup.m LIST_SRCMATLAB_RST = \ $(shell echo "$(LIST_SRCMATLAB)" | \ sed -e "s+$(DIRSRC)/PROGRAMMES/+$(DIRTMP)+g" \ -e "s+$(DIRSRC)/RESULTATS/+$(DIRTMP)+g" \ -e "s+\.m+.m.rst+g") LIST_SRCMATLAB_HTML = \ $(shell echo "$(LIST_SRCMATLAB)" | \ sed -e "s+$(DIRSRC)/PROGRAMMES/+$(DIRWWW)/manuals/html/many/+g" \ -e "s+$(DIRSRC)/RESULTATS/+$(DIRWWW)/manuals/html/many/+g" \ -e "s+\.m+.m.html+g") LIST_SRCMATLAB_PDF = \ $(shell echo "$(LIST_SRCMATLAB)" | \ sed -e "s+$(DIRSRC)/PROGRAMMES/+$(DIRWWW)/manuals/pdf/many/+g" \ -e "s+$(DIRSRC)/RESULTATS/+$(DIRWWW)/manuals/pdf/many/+g" \ -e "s+\.m+.m.pdf+g") RST2HTML = \ rst2html RST2LATEX = \ rst2latex RST2LATEX_OPTIONS_ONE = \ --documentclass=book \ --stylesheet=manual_one.sty \ --use-latex-toc \ --section-numbering \ --traceback \ --use-verbatim-when-possible RST2LATEX_OPTIONS_MANY = \ --documentclass=article \ --stylesheet=manuals_many.sty \ --traceback \ --use-verbatim-when-possible .PHONY : \ help \ before \ clean \ htmllinkcheckb \ htmllinkchecka \ spellcheck \ all \ html \ pdf help : @echo "Prepare output directories :" @echo "\$$ make before" @echo "" @echo "Following commands are available to build outputs :" @echo "\$$ make all" @echo " " @echo "Check links before installation : " @echo "\$$ make htmllinkcheckb" @echo " " @echo "Last step = installation of HTML and pdf files" @echo "\$$ make install_all" @echo " " @echo "Check links after installation : " @echo "\$$ make htmllinkchecka" @echo " " before : @mkdir -p $(DIRWWW)/manuals/html/one/ @mkdir -p $(DIRWWW)/manuals/html/many/ @mkdir -p $(DIRWWW)/manuals/pdf/one/ @mkdir -p $(DIRWWW)/manuals/pdf/many/ install_all : \ install_html \ install_pdf install_html : @$(DIRADM)/install.sh -w $(DIRWWW)/manuals/html/ -u $(URLPUBLISH)/html/ install_pdf : @$(DIRADM)/install.sh -w $(DIRWWW)/manuals/pdf/ -u $(URLPUBLISH)/pdf/ clean : \ cleantmp -@rm -fr $(DIRWWW)/manuals/html/ -@rm -fr $(DIRWWW)/manuals/pdf/ -@rm -fr $(DIRWWW)/src_browser/ cleantmp : -@rm -f $(DIRTMP)/all.xml -@rm -f $(DIRTMP)/*.rst -@rm -f $(DIRTMP)/*.rst[12] -@rm -f $(DIRTMP)/links.rst* -@rm -f $(DIRTMP)/*.tex -@rm -f $(DIRWWW)/manuals/pdf/one/*.aux -@rm -f $(DIRWWW)/manuals/pdf/one/*.log -@rm -f $(DIRWWW)/manuals/pdf/one/*.out -@rm -f $(DIRWWW)/manuals/pdf/many/*.aux -@rm -f $(DIRWWW)/manuals/pdf/many/*.log -@rm -f $(DIRWWW)/manuals/pdf/many/*.out htmllinkcheckb : @$(DIRADM)/linkchecker.sh -d $(DIRWWW)/manuals/html/ htmllinkchecka : @$(DIRADM)/linkchecker.sh -u $(URLPUBLISH) spellcheck : @++aspell --mode=sgml --master=english -c \ $(DIRSRC)/$(PRODUCT).xml all : \ man_html \ man_pdf man_html : \ man_html_one \ man_html_many man_html_one : \ $(DIRWWW)/manuals/html/one/index.html man_html_many : \ $(DIRWWW)/manuals/html/many/index.html \ $(LIST_SRCSH_HTML) \ $(LIST_SRCMATLAB_HTML) man_pdf : \ man_pdf_one \ man_pdf_many man_pdf_one : \ $(DIRWWW)/manuals/pdf/one/$(PRODUCT)_manuals.pdf \ man_pdf_many : \ $(LIST_SRCSH_PDF) \ $(LIST_SRCMATLAB_PDF) $(DIRWWW)/manuals/html/many/index.html : \ $(DIRTMP)/index_many.rst @$(RST2HTML) --input-encoding=ISO-8859-15 --strict \ $< $@ $(DIRWWW)/manuals/html/one/index.html : \ $(DIRTMP)/$(PRODUCT)_manuals.rst @$(RST2HTML) --input-encoding=ISO-8859-15 --strict \ $< $@ $(DIRWWW)/manuals/pdf/one/$(PRODUCT)_manuals.pdf : \ $(DIRTMP)/$(PRODUCT)_manuals.tex @-pdflatex -output-directory $(DIRWWW)/manuals/pdf/one/ $< @-pdflatex -output-directory $(DIRWWW)/manuals/pdf/one/ $< $(DIRTMP)/$(PRODUCT)_manuals.tex : \ $(DIRTMP)/$(PRODUCT)_manuals.rst @$(RST2LATEX) $(RST2LATEX_OPTIONS_ONE) --input-encoding=ISO-8859-15 --strict \ $< $@ $(DIRTMP)/$(PRODUCT)_manuals.rst : \ $(DIRTMP)/index_one.rst \ $(LIST_SRCSH_RST) \ $(LIST_SRCMATLAB_RST) echo "$(LIST_SRCMATLAB_RST)" @cat $(DIRTMP)/index_one.rst > ${DIRTMP}/$(PRODUCT)_manuals.rst1 @echo "Shell scripts" >> ${DIRTMP}/$(PRODUCT)_manuals.rst1 @echo "=============" >> ${DIRTMP}/$(PRODUCT)_manuals.rst1 @for file in $(LIST_SRCSH); \ do echo " " >> ${DIRTMP}/$(PRODUCT)_manuals.rst1; \ echo " " >> ${DIRTMP}/$(PRODUCT)_manuals.rst1; \ echo ".. _$$(basename $${file}) :" >> ${DIRTMP}/$(PRODUCT)_manuals.rst1; \ echo " " >> ${DIRTMP}/$(PRODUCT)_manuals.rst1; \ echo "$$(basename $${file})" >> ${DIRTMP}/$(PRODUCT)_manuals.rst1; \ echo "$$(basename $${file} | tr [:print:] -)" >> ${DIRTMP}/$(PRODUCT)_manuals.rst1 ; \ echo " " >> ${DIRTMP}/$(PRODUCT)_manuals.rst1; \ sed -e "s/^==*$$/-----------------/" \ -e "s/^--*$$/~~~~~~~~~~~~~~~~~~~~/" \ ${DIRTMP}/$$(basename $${file}).rst >> ${DIRTMP}/$(PRODUCT)_manuals.rst1; \ done @echo "MATLAB scripts" >> ${DIRTMP}/$(PRODUCT)_manuals.rst1 @echo "==============" >> ${DIRTMP}/$(PRODUCT)_manuals.rst1 @for file in $(LIST_SRCMATLAB); \ do echo " " >> ${DIRTMP}/$(PRODUCT)_manuals.rst1; \ echo " " >> ${DIRTMP}/$(PRODUCT)_manuals.rst1; \ echo ".. _$$(basename $${file}) :" >> ${DIRTMP}/$(PRODUCT)_manuals.rst1; \ echo " " >> ${DIRTMP}/$(PRODUCT)_manuals.rst1; \ echo "$$(basename $${file})" >> ${DIRTMP}/$(PRODUCT)_manuals.rst1; \ echo "$$(basename $${file} | tr [:print:] -)" >> ${DIRTMP}/$(PRODUCT)_manuals.rst1 ; \ echo " " >> ${DIRTMP}/$(PRODUCT)_manuals.rst1; \ sed -e "s/^==*$$/-----------------/" \ -e "s/^--*$$/~~~~~~~~~~~~~~~~~~~~/" \ ${DIRTMP}/$$(basename $${file}).rst >> ${DIRTMP}/$(PRODUCT)_manuals.rst1; \ done @grep "\.\. _.*: .*$$" ${DIRTMP}/$(PRODUCT)_manuals.rst1 > \ ${DIRTMP}/links.rst @sed -e "s/^ *//" ${DIRTMP}/links.rst | sort -u > ${DIRTMP}/links.rst2 @sed -e "/\.\. _.*: .*$$/d" ${DIRTMP}/$(PRODUCT)_manuals.rst1 > \ ${DIRTMP}/$(PRODUCT)_manuals.rst2 @cp ${DIRTMP}/$(PRODUCT)_manuals.rst2 $@ $(DIRTMP)/index_one.rst : @echo "$(PRODUCTNAME) manuals" | tr [:print:] = >> $@ @echo "$(PRODUCTNAME) manuals" >> $@ @echo "$(PRODUCTNAME) manuals" | tr [:print:] = >> $@ @echo " " >> $@ @echo ".. contents:: Table of Contents" >> $@ @echo " :depth: 2" >> $@ @echo ".. section-numbering::" >> $@ @echo " " >> $@ $(DIRTMP)/index_many.rst : @echo "$(PRODUCTNAME) manuals" | tr [:print:] = >> $@ @echo "$(PRODUCTNAME) manuals" >> $@ @echo "$(PRODUCTNAME) manuals" | tr [:print:] = >> $@ @echo " " >> $@ @echo "Shell scripts" >> $@ @echo "=============" >> $@ @for file in $(LIST_SRCSH); \ do echo " "; \ echo ".. _$$(basename $${file}) : $$(basename $${file}).html"; \ echo " "; \ echo "- $$(basename $${file})_"; \ done >> $@ @echo " " >> $@ @echo "MATLAB scripts" >> $@ @echo "==============" >> $@ @for file in $(LIST_SRCMATLAB); \ do echo " "; \ echo ".. _$$(basename $${file}) : $$(basename $${file}).html"; \ echo " "; \ echo "- $$(basename $${file})_"; \ done >> $@ @echo " " >> $@ $(DIRWWW)/manuals/html/many/%.html:$(DIRTMP)/%.rst @$(RST2HTML) --input-encoding=ISO-8859-15 --strict \ $< $@ $(DIRWWW)/manuals/pdf/many/%.pdf : $(DIRTMP)/%.tex @-pdflatex -output-directory $(DIRWWW)/manuals/pdf/many/ $< @-pdflatex -output-directory $(DIRWWW)/manuals/pdf/many/ $< $(DIRTMP)/%.tex : $(DIRTMP)/%.rst @$(RST2LATEX) $(RST2LATEX_OPTIONS_MANY) --input-encoding=ISO-8859-15 --strict \ $< $@ $(DIRTMP)/%.sh.rst : $(DIRSRC)/PROGRAMMES/%.sh @$(DIRADM)/extract_rst.sh -i $< -l sh -o $@ $(DIRTMP)/%.m.rst : $(DIRSRC)/PROGRAMMES/%.m @$(DIRADM)/extract_rst.sh -i $< -l matlab -o $@ $(DIRTMP)/%.m.rst : $(DIRSRC)/RESULTATS/%.m @$(DIRADM)/extract_rst.sh -i $< -l matlab -o $@