1# Language
2LANG=en_US.utf8
3
4# Where is the htmlbook program
5ifndef HTMLBOOK
6HTMLBOOK=htmlbook
7endif
8
9# Resolution when converting from FIG to bitmaps
10ifndef FIGPNGRES
11FIGPNGRES=96
12endif
13
14TEXTFILES := $(wildcard *.txt)
15HBTFILES  := $(wildcard *.hbt)
16PRJFILES  := $(wildcard *.prj)
17
18FIGIMAGES := \
19	$(patsubst %.fig,%.png,$(wildcard *.fig)) \
20	$(patsubst %.fig,%.pdf,$(wildcard *.fig)) \
21	$(patsubst %.fig,%.svg,$(wildcard *.fig))
22
23%.svg:	%.fig
24	gxhconvert -o=svg $<
25
26%.pdf:	%.fig
27	gxhconvert -o=pdf $<
28
29%.png:	%.fig
30	gxhconvert -o=png -r=$(FIGPNGRES) -a $<
31	optipng -q -i1 -zc1-9 -zm1-9 -zs0-3 -f0-5 $@
32
33ICONS=	favicon.ico
34
35#
36#	The first target is the default target.
37#
38install:		# Create HTML page set for local viewing
39install:	$(TEXTFILES) $(HBTFILES) $(PRJFILES) $(FIGIMAGES) favicon.ico
40	-[ ! -f htmlbook.sh ] || rm -f htmlbook.sh
41	LANG=$(LANG) $(HTMLBOOK) index.prj
42	chmod 755 htmlbook.sh
43	./htmlbook.sh
44
45webinstall:		# Create HTML page set for web server
46webinstall:	$(TEXTFILES) $(HBTFILES) $(PRJFILES) $(FIGIMAGES) $(ICONS)
47	-[ ! -f htmlbook.sh ] || rm -f htmlbook.sh
48	LANG=$(LANG) $(HTMLBOOK) -o web index.prj
49	chmod 755 htmlbook.sh
50	./htmlbook.sh
51
52chminstall:		# Create HTML page set to build CHM help file
53chminstall:	$(TEXTFILES) $(HBTFILES) $(PRJFILES) $(FIGIMAGES) $(ICONS)
54	-[ ! -f htmlbook.sh ] || rm -f htmlbook.sh
55	LANG=$(LANG) $(HTMLBOOK) -o chm index.prj
56	chmod 755 htmlbook.sh
57	./htmlbook.sh
58
59icons:			# Icon set
60icons:	home.png toc.png prev.png next.png index.png
61
62favicon.ico:		# Favourite icon for web server
63favicon.ico:
64	ln ../../../../resources/gui-img/icons/dkicon.ico favicon.ico
65
66clean:			# Clean directory (remove all non-source files)
67clean:
68	for i in $(FIGIMAGES) ; do [ ! -f "$i" ] || rm -f "$i" ; done
69
70help:			# Show targets in GNUmakefile
71	@echo 'Here is a list of the targets in this GNUmakefile:'
72	-@egrep '^[^:;=        ]*::?[  ]*' GNUmakefile|grep '#'|grep -v '^#'
73
74