summaryrefslogtreecommitdiff
path: root/Doc/Manual/Makefile
blob: 5112afa3318106e70c6f953bb0991daa13250ba2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# Makefile for generating the SWIG documentation
#
# Note that the htmldoc package needs to be installed, but requires patching (using the
# margin-left.patch file from this directory) in order to correctly generate the pdf docs.
# The .html files are first processed and updated with chapter numbering and anchor names
# are added to the HTML headings using the python scripts. The htmldoc program is then
# used to generate the PDF document and single page HTML version of the documentation.
# HTML TIDY (package also known as tidy) is also required and is used as an aid to HTML
# validation.
#
# Additional html validation can be done using the validate target.
# Additional link checking can be done using the linkchecker target.
#

# Note the # and " are escaped
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"

.PHONY: maketoc check generate all maintainer-clean validate test

all: maketoc check generate

maketoc: CCache.html
	python maketoc.py

CCache.html: ../../CCache/ccache.yo
	yodl2html -o CCache.html ../../CCache/ccache.yo

# Use htmltidy to warn about some HTML errors. Note that it is not used to clean/tidy the HTML,
# it is just used as a primitive HTML checker.
# CCache.html is generated by yodl2html and has a few insignificant problems, so we don't put it through tidy
check:
	tidy -errors --gnu-emacs yes -quiet index.html
	tidy -errors --gnu-emacs yes -quiet Sections.html
	all=`sed '/^#/d' chapters | grep -v CCache.html`; for a in $$all; do tidy -errors --gnu-emacs yes -quiet $$a; done;

generate: swightml.book swigpdf.book
	htmldoc --batch swightml.book || true
	htmldoc --batch swigpdf.book || true
	python fixstyle.py SWIGDocumentation.html

swigpdf.book: chapters Sections.html
	echo "#HTMLDOC 1.8.24" > swigpdf.book
	echo -t pdf13 -f SWIGDocumentation.pdf $(HTMLDOC_OPTIONS) --stylesheet style.css >> swigpdf.book
	echo "Sections.html" >> swigpdf.book
	cat chapters >> swigpdf.book

swightml.book: chapters Sections.html
	echo "#HTMLDOC 1.8.24" > swightml.book
	echo -t html -f SWIGDocumentation.html $(HTMLDOC_OPTIONS) >> swightml.book
	echo "Sections.html" >> swightml.book
	cat chapters >> swightml.book

maintainer-clean: clean-baks
	rm -f swightml.book
	rm -f swigpdf.book
	rm -f CCache.html
	rm -f SWIGDocumentation.html
	rm -f SWIGDocumentation.pdf

clean-baks:
	rm -f *.bak

test:
	grep "href=\".*\.html\"" index.html
	grep "href=\".*\.html\"" Sections.html
	all=`sed '/^#/d' chapters`; for a in $$all; do grep -l "href=\".*\.html\"" $$a; done;

# Validating using the WDG offline validator - http://www.htmlhelp.com/tools/validator/offline/
validate:
	all=`sed '/^#/d' chapters`; for a in $$all; do validate --emacs $$a; done;

# Link checking using linkchecker
linkchecker:
	@echo -----------------------------------------------------------------------
	@echo Note linkchecker versions prior to 6.1 do not work properly wrt anchors
	@echo -----------------------------------------------------------------------
	linkchecker --config=./linkchecker.config index.html