| 1 | # Makefile for generating the SWIG documentation |
| 2 | # |
| 3 | # Note that the htmldoc package needs to be installed, but requires patching (using the |
| 4 | # margin-left.patch file from this directory) in order to correctly generate the pdf docs. |
| 5 | # The .html files are first processed and updated with chapter numbering and anchor names |
| 6 | # are added to the HTML headings using the python scripts. The htmldoc program is then |
| 7 | # used to generate the PDF document and single page HTML version of the documentation. |
| 8 | # HTML TIDY (package also known as tidy) is also required and is used as an aid to HTML |
| 9 | # validation. |
| 10 | # |
| 11 | # Additional html validation can be done using the validate target. |
| 12 | # |
| 13 | |
| 14 | # Note the # and " are escaped |
| 15 | HTMLDOC_OPTIONS = "--book --toclevels 4 --no-numbered --toctitle \"Table of Contents\" --title --titleimage swig16.png --linkcolor \#0000ff --linkstyle underline --size Universal --left 0.50in --right 0.50in --top 0.50in --bottom 0.50in --header .t. --footer h.1 --nup 1 --tocheader .t. --tocfooter ..i --portrait --color --no-pscommands --no-xrxcomments --compression=1 --jpeg=0 --fontsize 10.0 --fontspacing 1.2 --headingfont Helvetica --bodyfont Times --headfootsize 10.0 --headfootfont Helvetica --charset iso-8859-1 --links --no-embedfonts --pagemode outline --pagelayout single --firstpage c1 --pageeffect none --pageduration 10 --effectduration 1.0 --no-encryption --permissions all --owner-password \"\" --user-password \"\" --browserwidth 680" |
| 16 | |
| 17 | .PHONY: maketoc check generate all clean validate test |
| 18 | |
| 19 | all: maketoc check generate |
| 20 | |
| 21 | maketoc: |
| 22 | python maketoc.py |
| 23 | |
| 24 | # Use htmltidy to warn about some HTML errors. Note that it is not used to clean/tidy the HTML, |
| 25 | # it is just used as a primitive HTML checker. |
| 26 | check: |
| 27 | tidy -errors --gnu-emacs yes -quiet index.html |
| 28 | tidy -errors --gnu-emacs yes -quiet Sections.html |
| 29 | all=`sed '/^#/d' chapters`; for a in $$all; do tidy -errors --gnu-emacs yes -quiet $$a; done; |
| 30 | |
| 31 | generate: swightml.book swigpdf.book |
| 32 | htmldoc --batch swightml.book || true |
| 33 | htmldoc --batch swigpdf.book || true |
| 34 | python fixstyle.py SWIGDocumentation.html |
| 35 | |
| 36 | swigpdf.book: |
| 37 | echo "#HTMLDOC 1.8.24" > swigpdf.book |
| 38 | echo -t pdf13 -f SWIGDocumentation.pdf $(HTMLDOC_OPTIONS) --stylesheet style.css >> swigpdf.book |
| 39 | echo "Sections.html" >> swigpdf.book |
| 40 | cat chapters >> swigpdf.book |
| 41 | |
| 42 | swightml.book: |
| 43 | echo "#HTMLDOC 1.8.24" > swightml.book |
| 44 | echo -t html -f SWIGDocumentation.html $(HTMLDOC_OPTIONS) >> swightml.book |
| 45 | echo "Sections.html" >> swightml.book |
| 46 | cat chapters >> swightml.book |
| 47 | |
| 48 | clean: |
| 49 | rm -f swightml.book |
| 50 | rm -f swigpdf.book |
| 51 | rm -f SWIGDocumentation.html |
| 52 | rm -f SWIGDocumentation.pdf |
| 53 | rm -f *.bak |
| 54 | |
| 55 | test: |
| 56 | grep "href=\".*\.html\"" index.html |
| 57 | grep "href=\".*\.html\"" Sections.html |
| 58 | all=`sed '/^#/d' chapters`; for a in $$all; do grep -l "href=\".*\.html\"" $$a; done; |
| 59 | |
| 60 | # Validating using the WDG offline validator - http://www.htmlhelp.com/tools/validator/offline/ |
| 61 | validate: |
| 62 | all=`sed '/^#/d' chapters`; for a in $$all; do validate --emacs $$a; done; |
| 63 | |