summaryrefslogtreecommitdiff
path: root/support/dktools/dktools/htmlbook/GNUmakefile
blob: f3bdb7e228e16701959918ad2d4a07895f7e8bde (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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# Copyright (C) 2020, Dirk Krause. All rights reserved.
# SPDX-License-Identifier: BSD-3-Clause

#
# CONFIGURATION:
# Set language here.
# If your LANG environment variable ends on ``.UTF-8'' or ``.utf8''
# you have to use the same suffix here.
#
ifndef LANG
LANG=en_US.utf8
endif

#
# CONFIGURATION:
# How to run the htmlbook program?
#
ifndef HTMLBOOK
HTMLBOOK=htmlbook
endif

ifndef GXHCONVERT
GXHCONVERT=LANG=C gxhconvert
endif

#
# CONFIGURATION:
# Resolution when converting from vector to bitmaps.
# Higher values create larger images.
#
ifndef FIGPNGRES
FIGPNGRES=96
endif

#
# If one of the *.prj, *.hbt or *.txt files was modified,
# we have to rebuild all.
#
TEXTFILES := $(wildcard *.txt)
HBTFILES  := $(wildcard *.hbt)
PRJFILES  := $(wildcard *.prj)

#
# All *.fig images, *.gp plots and *.tex files (formulas) are
# converted to *.png, *.pdf and *.svg.
#
IMAGES := \
	$(patsubst %.fig,%.png,$(wildcard *.fig)) \
	$(patsubst %.fig,%.pdf,$(wildcard *.fig)) \
	$(patsubst %.fig,%.svg,$(wildcard *.fig)) \
	$(patsubst %.wxd,%.png,$(wildcard *.wxd)) \
	$(patsubst %.wxd,%.pdf,$(wildcard *.wxd)) \
	$(patsubst %.wxd,%.svg,$(wildcard *.wxd)) \
	$(patsubst %.gp,%.png,$(wildcard *.gp)) \
	$(patsubst %.gp,%.pdf,$(wildcard *.gp)) \
	$(patsubst %.gp,%.svg,$(wildcard *.gp)) \
	$(patsubst %.tex,%.png,$(wildcard *.tex)) \
	$(patsubst %.tex,%.pdf,$(wildcard *.tex)) \
	$(patsubst %.tex,%.svg,$(wildcard *.tex))

#
# Suffixes for graphics files
#
.SUFFIXES:	.png .svg .pdf .tex .fig .wxd .gp

#
# Graphics conversion rules
#
.tex.pdf:
	gxhconvert -o=pdf $<

.fig.pdf:
	gxhconvert -o=pdf $<

.wxd.pdf:
	gxhconvert -o=pdf $<

.gp.pdf:
	gxhconvert -o=pdf $<

.pdf.svg:
	gxhconvert -o=svg $<

#
# CONFIGURATION:
# If you do not need transparency, remove the -a option from the
# gxhconvert command below.
#
.svg.png:
	gxhconvert -o=png -r=$(FIGPNGRES) -a $<
	optipng -q -i1 -zc1-9 -zm1-9 -zs0-3 -f0-5 $@

#
# Names of icon files
#
ICONS=	home.svg toc.svg prev.svg next.svg index.svg

#
#	The first target is the default target.
#
install:		# Create HTML page set for local viewing and install
install:	$(TEXTFILES) $(HBTFILES) $(PRJFILES) $(IMAGES)
	-[ ! -f htmlbook.sh ] || rm -f htmlbook.sh
	LANG=$(LANG) $(HTMLBOOK) index.prj
	chmod 755 htmlbook.sh
	./htmlbook.sh

webinstall:		# Create HTML page set for web server and install
webinstall:	$(TEXTFILES) $(HBTFILES) $(PRJFILES) $(IMAGES) $(ICONS)
	-[ ! -f htmlbook.sh ] || rm -f htmlbook.sh
	LANG=$(LANG) $(HTMLBOOK) -o web index.prj
	chmod 755 htmlbook.sh
	./htmlbook.sh

chminstall:		# Create HTML page set for CHM file building
chminstall:	$(TEXTFILES) $(HBTFILES) $(PRJFILES) $(IMAGES)
	-[ ! -f htmlbook.sh ] || rm -f htmlbook.sh
	LANG=$(LANG) $(HTMLBOOK) -o chm index.prj
	chmod 755 htmlbook.sh
	./htmlbook.sh

#
# Icons
#

home.svg:		# Icon to return to homepage
home.svg:	home.wxd
	gxhconvert -o=svg -a $<

toc.svg:		# Icon for table of contents
toc.svg:	toc.wxd
	gxhconvert -o=svg -a $<

prev.svg:		# Icon to go back to previous page
prev.svg:	prev.wxd
	gxhconvert -o=svg -a $<

next.svg:		# Icon to go forward to next page
next.svg:	next.wxd
	gxhconvert -o=svg -a $<

index.svg:		# Icon to go to keyword index
index.svg:	index.wxd
	gxhconvert -o=svg -a $<

help:			# Show targets in GNUmakefile
	@echo 'Here is a list of the targets in this GNUmakefile:'
	-@egrep '^[^:;=        ]*::?[  ]*' GNUmakefile|grep '#'|grep -v '^#'