-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchm.make
47 lines (40 loc) · 1.64 KB
/
chm.make
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
# Create CHM help files for Win32
# Copyright 2017 John Ralls <[email protected]>
# Procedure lifted from make_chm() in gnucash-on-windows.git:install-impl.sh,
# originally written by Andreas Köhler.
chmfile=$(docname).chm
mapfile=$(docname).hhmap
htmlhelp_xsl="http://docbook.sourceforge.net/release/xsl/current/htmlhelp/htmlhelp.xsl"
$(chmfile): $(entities) $(figfiles)
$(mapfile): $(chmfile)
chm-local: $(chmfile) $(mapfile)
install-chm-local: $(chmfile) $(mapfile)
$(mkinstalldirs) $(DESTDIR)$(docdir)/$(lang)
$(INSTALL_DATA) $(chmfile) $(DESTDIR)$(docdir)/$(lang)
$(INSTALL_DATA) $(mapfile) $(DESTDIR)$(docdir)/$(lang)
.xml.chm:
${XSLTPROC} ${htmlhelp_xsl} ${srcdir}/$(docname).xml
count=0
echo >> htmlhelp.hhp
echo "[ALIAS]" >> htmlhelp.hhp
echo "IDH_0=index.html" >> htmlhelp.hhp
echo "#define IDH_0 0" > mymaps
echo "[Map]" > htmlhelp.hhmap
echo "Searching for anchors ..."
for id in `cat ${srcdir}/*.xml | sed '/sect.*id=/!d;s,.*id=["'\'']\([^"'\'']*\)["'\''].*,\1,'` ; do \
files=`grep -l "[\"']${id}[\"']" *.html` || continue; \
echo "IDH_$((++count))=${files}#${id}" >> htmlhelp.hhp; \
echo "#define IDH_${count} ${count}" >> mymaps; \
echo "${id}=${count}" >> htmlhelp.hhmap; \
done
echo >> htmlhelp.hhp
echo "[MAP]" >> htmlhelp.hhp
cat mymaps >> htmlhelp.hhp
rm mymaps
"${HHC}" htmlhelp.hhp >/dev/null || true
mv htmlhelp.chm $(chmfile)
mv htmlhelp.hhmap $(mapfile)
CLEANFILES += $(chmfile) $(mapfile) htmlhelp.hhp *.html toc.hhc
# Don't try to make dist from windows, this is here only to silence an
# error from the Italian translations.
EXTRA_DIST = $(entities) $(docname).xml