Debian Codegraph @

doc/Makefile

raw symbols SCIP
1 # CLISP Implementation Notes generation
2 # (C) 2000-2011 Sam Steingold
3 # (C) 2024 Bruno Haible
4
5 # To generate HTML, you will need xsltproc & xmllint from the libxml2
6 # (http://xmlsoft.org/) package in addition to the DocBook DTDs and XSL
7 # stylesheets (http://www.docbook.org/)
8 # When writing docbook documentation, you need the "DocBook Definitive Guide"
9 # http://docbook.org/tdg/en/html/docbook-x.html
10
11 # which DTD to validate against
12 DTDVER=4.5
13
14 # all included XML files
15 IMPNOTES=cl-ent.xml clhs-ent.xml impbody.xml impent.xml mop.xml gray.xml \
16 impext.xml impissue.xml impbyte.xml unix-ent.xml mop-ent.xml faq.xml \
17 history.xml fdl-1.3.dbk gpl-2.0.dbk \
18 ../modules/asdf/asdf.xml \
19 ../modules/berkeley-db/berkeley-db.xml \
20 ../modules/berkeley-db/ent-bdb.xml \
21 ../modules/dbus/dbus.xml \
22 ../modules/dirkey/dirkey.xml \
23 ../modules/fastcgi/fastcgi.xml \
24 ../modules/gdbm/gdbm.xml \
25 ../modules/gtk2/gtk.xml \
26 ../modules/i18n/i18n.xml \
27 ../modules/libsvm/svm.xml \
28 ../modules/matlab/matlab.xml \
29 ../modules/netica/netica.xml \
30 ../modules/oracle/oracle.xml \
31 ../modules/pari/pari.xml \
32 ../modules/pcre/pcre.xml \
33 ../modules/postgresql/postgresql.xml \
34 ../modules/rawsock/rawsock.xml \
35 ../modules/readline/readline.xml \
36 ../modules/regexp/regexp.xml \
37 ../modules/syscalls/syscalls.xml \
38 ../modules/zlib/zlib.xml
39 # all used stylesheets
40 CLISP_XSL = chunk.xsl common.xsl fo.xsl id-href-map.xsl man.xsl pile.xsl
41 CLISP_CSS = impnotes.css
42 # targets for <olink> resolution
43 OLINK = man.tdb clink.tdb pile.tdb chunk.tdb olink-pile.xml olink-chunk.xml
44
45 RM=/bin/rm -f
46 CURDIR=$(shell pwd)
47
48 # what to do when there is no local system-wide DTD & XSL?
49 DOWNLOAD=yes
50
51 ifneq (,$(filter Windows%,$(OS)))
52 DTD_PATH=$(firstword $(wildcard ./docbook-dtd*/docbookx.dtd \
53 /usr/share/docbook-xml$(DTDVER)/docbookx.dtd))
54 # Make sure to use a trailing slash.
55 XSL_PATH=$(firstword $(wildcard ./docbook-xsl*/ \
56 /usr/share/docbook-xsl*/))
57 FOP=/cygdrive/c/java/fop-0.20.5/fop.bat
58 else
59 DTD_PATH=$(firstword $(wildcard ./docbook-dtd*/docbookx.dtd \
60 /usr/share/sgml/docbook/xml-dtd-$(DTDVER)*/docbookx.dtd \
61 /usr/share/xml/docbook/schema/dtd/$(DTDVER)*/docbookx.dtd))
62 XSL_PATH=$(firstword $(wildcard ./docbook-xsl*/ \
63 /usr/share/sgml/docbook/xsl-stylesheets-1*/ \
64 /usr/share/xml/docbook/stylesheet/nwalsh*/))
65 FOP=../../../fop/fop
66 endif
67
68 IN_FILES = impnotes.xml clisp.xml clisp-link.xml
69 # common dependencies for all checkers
70 CHECK_DEPS = $(IN_FILES)
71 ifeq (,$(wildcard $(DTD_PATH))) # DTD does not exist
72 ifeq (yes,$(DOWNLOAD)) # download once
73 CHECK_DEPS += docbook-dtd
74 DTD_PATH=./docbook-dtd/docbookx.dtd
75 else # download on each check (you need network-aware tools to use it)
76 # this is the original DTD
77 DTD_PATH=http://www.oasis-open.org/docbook/xml/$(DTDVER)/docbookx.dtd
78 #DTD_PATH=http://www.docbook.org/xml/$(DTDVER)/docbookx.dtd
79 endif
80 endif
81
82 # common dependencies for all generators
83 GEN_DEPS = common.xsl
84 ifeq (,$(wildcard $(XSL_PATH))) # stylesheets do not exist
85 ifeq (yes,$(DOWNLOAD)) # download once
86 GEN_DEPS += docbook-xsl
87 XSL_PATH=./docbook-xsl/
88 else # download on each build (you need network-aware tools to use it)
89 XSL_PATH=http://docbook.xml-doc.org/snapshots/xsl/
90 # XSL_PATH=http://docbook.sourceforge.net/release/xsl/snapshot/
91 # XSL_PATH=http://docbook.sourceforge.net/release/xsl/current/
92 endif
93 endif
94
95 # The xmlcatalog utility (from libxml2)
96 XMLCATALOG=xmlcatalog
97
98 # chose one:
99 #TEXI2HTML=texi2html -monolithic -verbose $< -out_file $@
100 TEXI2HTML=makeinfo --verbose --no-split --no-headers --force --html $< -o $@
101
102 # NB: keep in sync with src/makemake.in:MYIMPROOT
103 DIST_SFBETA = sds,[email protected]:/home/groups/c/cl/clisp/htdocs/beta
104 DIST =
105 RSYNC = rsync -avC --copy-unsafe-links
106 CHMOD = chmod -R a+rX
107
108 ##### nothing user-serviceable below #####
109
110 # name of XML catalog file to create
111 # (if not specified, no local catalog created or used)
112 CATALOG_FILE=catalog.xml
113
114 # Stylesheets URI used internally in the CLISP project *.xsl files.
115 XSL_URI=http://docbook.sourceforge.net/release/xsl/current/
116
117 FILLIN=. ../version.sh && sed -e 's,@DTD@,$(DTD_PATH),' \
118 -e 's,@DTDVER@,$(DTDVER),' \
119 -e 's,@VERSION@,'$${VERSION_NUMBER}',' \
120 -e 's,@TODAY@,'`date +"%Y-%m-%d"`','
121
122 # cannot use profiling <http://www.sagehill.net/docbookxsl/Profiling.html>
123 # because that would require XSL tools to be installed on user machine
124 SGML_UNCOMMENT=-e 's/^<!--\#\(.*\)-->$$/\#\1/'
125
126 E=\ *<!--\(\#[^-]*\)--> *
127 ROFF_UNCOMMENT=-e 's/^$E$$/\1/' -e 's/$E$$/\n\1/' -e 's/^$E/\1\n/' -e 's/$E/\n\1\n/g'
128
129 .PHONY : all up count search clean
130
131 all: check impnotes.html regexp.html man
132
133 ifneq (,$(CATALOG_FILE))
134 # depends on Makefile because of $(XSL_PATH)
135 # gnu license xml files specify a bad dtd file
136 GNU_DTD = http://www.oasis-open.org/docbook/xml/$(DTDVER)/docbookx.dtd
137 $(CATALOG_FILE): Makefile
138 $(RM) $(CATALOG_FILE)
139 $(XMLCATALOG) --create > $(CATALOG_FILE)
140 $(XMLCATALOG) --noout --add "rewriteURI" \
141 $(XSL_URI) $(XSL_PATH) $(CATALOG_FILE)
142 $(XMLCATALOG) --noout --add "rewriteSystem" \
143 $(XSL_URI) $(XSL_PATH) $(CATALOG_FILE)
144 $(XMLCATALOG) --noout --add "rewriteURI" \
145 $(GNU_DTD) $(DTD_PATH) $(CATALOG_FILE)
146 XSLTPROC=XML_CATALOG_FILES="$(CATALOG_FILE) ${XML_CATALOG_FILES}" xsltproc
147 else
148 XSLTPROC=xsltproc
149 endif
150 XMLS_COMMON = --timing --xinclude
151
152 # target.database.document in this command is a workaround for bug
153 # warning: failed to load external entity \"olinkdb.xml\"
154 # Olink error: could not open target database \'olinkdb.xml\'.
155 # https://sourceforge.net/p/docbook/bugs/1111/
156 MAKE_TDB=$(XSLTPROC) $(XMLS_COMMON) --stringparam collect.xref.targets "only" \
157 --stringparam target.database.document "olink-pile.xml" \
158 --stringparam targets.filename
159
160 man.tdb: clisp.xml pile.xsl $(GEN_DEPS) $(CATALOG_FILE)
161 $(MAKE_TDB) "$@" pile.xsl $<
162
163 clink.tdb: clisp-link.xml pile.xsl $(GEN_DEPS) $(CATALOG_FILE)
164 $(MAKE_TDB) "$@" pile.xsl $<
165
166 pile.tdb: impnotes.xml $(IMPNOTES) pile.xsl $(GEN_DEPS) $(CATALOG_FILE)
167 $(MAKE_TDB) "$@" pile.xsl $<
168
169 chunk.tdb: impnotes.xml $(IMPNOTES) chunk.xsl $(GEN_DEPS) $(CATALOG_FILE)
170 $(MAKE_TDB) "$@" chunk.xsl $<
171
172 ifneq (,$(wildcard ../version.sh))
173 clisp.xml: clisp.xml.in ../version.sh Makefile
174 $(RM) $@
175 $(FILLIN) $< > $@
176
177 clisp-link.xml: clisp-link.xml.in ../version.sh Makefile
178 $(RM) $@
179 $(FILLIN) $< > $@
180
181 impnotes.xml: impnotes.xml.in $(IMPNOTES) ../version.sh Makefile
182 $(RM) $@
183 $(FILLIN) $< > $@
184 endif
185
186 XMLOUT=$(XSLTPROC) $(XMLS_COMMON) --stringparam target.database.document
187 DOC_MAN = --stringparam current.docid "man"
188 DOC_CLK = --stringparam current.docid "clink"
189 DOC_IMP = --stringparam current.docid "impnotes"
190
191 # Post-processing of man.xsl output.
192 # Add a newline before .PP, see
193 # <https://sourceforge.net/p/clisp/bugs/748/>
194 # <https://bugs.launchpad.net/ubuntu/+source/clisp/+bug/2022970>
195 # <https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1041788>
196 # Replace old 'an-trap' with newer 'an-input-trap' (no visible effect), see
197 # <https://savannah.gnu.org/bugs/?61002>.
198 MAN_XSL_POSTPROCESS = sed -i -e 's/\(.\)\.PP/\1\n.PP/g' -e 's/an-trap/an-input-trap/'
199
200 CHECK_IDS = if egrep -Hnr 'id="id[0-9]*"' $@; then exit 1; else true; fi
201
202 clisp.html: clisp.xml $(GEN_DEPS) pile.xsl $(OLINK)
203 $(XMLOUT) "olink-pile.xml" $(DOC_MAN) -o $@ pile.xsl $<
204 $(CHECK_IDS)
205
206 clisp.1: clisp.xml $(GEN_DEPS) man.xsl $(OLINK)
207 $(XMLOUT) "olink-pile.xml" $(DOC_MAN) -o $@ man.xsl $<
208 $(MAN_XSL_POSTPROCESS) $@
209
210 clisp-link.html: clisp-link.xml $(GEN_DEPS) pile.xsl $(OLINK)
211 $(XMLOUT) "olink-pile.xml" $(DOC_CLK) -o $@ pile.xsl $<
212 $(CHECK_IDS)
213
214 clisp-link.1: clisp-link.xml $(GEN_DEPS) man.xsl $(OLINK)
215 $(XMLOUT) "olink-pile.xml" $(DOC_CLK) -o $@ man.xsl $<
216 $(MAN_XSL_POSTPROCESS) $@
217
218 # Generates _clisp.html from clisp.html.
219 # For quality checking of _clisp.html, use "make -f Makefile.devel view-html".
220 _%.html: %.html
221 sed $(SGML_UNCOMMENT) $< > $@
222
223 # Generates _clisp.1 from clisp.1.
224 # For quality checking of _clisp.1, use "make -f Makefile.devel view-man"
225 # or "groff -man -Tutf8 _clisp.1 | less -R".
226 _%.1: %.1
227 sed $(ROFF_UNCOMMENT) $< > $@
228
229 check: $(IMPNOTES) $(CHECK_DEPS)
230 for f in $(IN_FILES); do \
231 xmllint $(XMLS_COMMON) --noout --postvalid --noent $$f; done
232
233 impnotes.texi: impnotes.xml $(IMPNOTES)
234 time docbook2texi $<
235
236 impnotes.html: impnotes.xml $(IMPNOTES) $(GEN_DEPS) pile.xsl $(OLINK)
237 $(XMLOUT) "olink-pile.xml" $(DOC_IMP) -o $@ pile.xsl $<
238 # cp impnotes.html impnotes-saved.html
239 # tidy -config tidy.conf -f tidy.err impnotes.html || true
240 $(CHECK_IDS)
241 (test -n "$(DIST)" && $(CHMOD) impnotes.html impnotes.css && \
242 $(RSYNC) impnotes.html impnotes.css $(DIST)/) || true
243
244 man: _clisp.html _clisp.1 _clisp-link.html _clisp-link.1
245 (cd ../build && make clisp.html clisp.1 && \
246 $(CHMOD) clisp.1 clisp.html && \
247 test -n "$(DIST)" && $(RSYNC) clisp.1 clisp.html $(DIST)/) || true
248
249 impnotes.fo: impnotes.xml $(IMPNOTES) fo.xsl $(XSL_TARGET)
250 $(XMLOUT) "olink-pile.xml" $(DOC_IMP) -o $@ fo.xsl $<
251
252 # http://xmlgraphics.apache.org/fop/
253 impnotes.pdf: impnotes.fo
254 ${FOP} $< $@
255
256 id-href.map : chunk.tdb
257 $(XSLTPROC) $(XMLS_COMMON) -o $@ id-href-map.xsl $<
258
259 html: impnotes.xml $(IMPNOTES) $(GEN_DEPS) chunk.xsl pile.xsl clisp.xml $(OLINK) id-href.map
260 if [ ! -h $@ ]; then $(RM) -r $@; \
261 if [ -d ../../sf/www/impnotes ]; then ln -s ../../sf/www/impnotes $@; \
262 elif [ -d ../../www/impnotes ]; then ln -s ../../www/impnotes $@; \
263 else echo 'no sf/www dir'; false; fi; fi
264 cd $@/ && grep -v -e "^#" .symlinks | sed 's/^/ln -vf /' | sh -
265 cp -pv impnotes.css id-href.map $@/
266 $(XMLOUT) "olink-chunk.xml" $(DOC_IMP) -o $@/ chunk.xsl $<
267 $(XMLOUT) "olink-chunk.xml" $(DOC_MAN) -o $@/clisp.html pile.xsl clisp.xml
268 $(XMLOUT) "olink-chunk.xml" $(DOC_CLK) -o $@/clisp-link.html pile.xsl clisp-link.xml
269 sed $(SGML_UNCOMMENT) $@/clisp.html > _clisp-1.html
270 sed $(SGML_UNCOMMENT) $@/clisp-link.html > _clisp-link-1.html
271 cd ../build; make clisp-1.html clisp-link-1.html;
272 mv -f ../build/clisp-1.html $@/clisp.html
273 mv -f ../build/clisp-link-1.html $@/clisp-link.html
274 rm -f _clisp-1.html _clisp-link-1.html
275 $(CHECK_IDS)
276 cd html; cd ..; $(CURDIR)/../utils/fix-perms.sh
277 (test -n "$(DIST)" && $(CHMOD) $@ impnotes.css && \
278 $(RSYNC) $@/*.html $@/id-href.map impnotes.css $(DIST)/impnotes/) \
279 || true
280
281 # try to use http://www.graphviz.org/ instead of openoffice for MOP
282 # class inheritance diagrams
283 mop-classes.png : mop-classes.dot
284 dot -Tpng mop-classes.dot -o mop-classes.png
285
286 up: impnotes.html html
287 mv html impnotes
288 $(CHMOD) impnotes.html impnotes
289 $(RSYNC) impnotes.html impnotes $(DIST_SFBETA)
290 mv impnotes html
291
292 regexp.html: ../modules/regexp/regexp.texinfo
293 $(TEXI2HTML)
294
295 clean: force
296 $(RM) impnotes.texi impnotes.html impnotes.pdf html \
297 clisp.html clisp.1 *.tdb $(CATALOG_FILE) impnotes.fo \
298 id-href.map clisp-link.html clisp-link.1
299 test -f impnotes.xml.in && $(RM) impnotes.xml
300 test -f clisp.xml.in && $(RM) clisp.xml
301 test -f clisp-link.xml.in && $(RM) clisp-link.xml
302
303 count: $(IMPNOTES)
304 wc $^
305
306 DTD_DOWNLOAD=http://www.docbook.org/xml/$(DTDVER)/docbook-xml-$(DTDVER).zip
307 docbook-dtd :
308 mkdir docbook-dtd && cd docbook-dtd && \
309 wget -O docbook-xml.zip $(DTD_DOWNLOAD) && \
310 unzip docbook-xml.zip && $(RM) docbook-xml.zip
311
312 #XSL_DOWNLOAD=https://sourceforge.net/projects/docbook/files/latest/download?source=files
313 XSL_VERSION=1.79.1
314 XSL_DOWNLOAD=https://downloads.sourceforge.net/project/docbook/docbook-xsl/$(XSL_VERSION)/docbook-xsl-$(XSL_VERSION).zip
315 docbook-xsl :
316 wget $(XSL_DOWNLOAD) && unzip docbook-xsl-$(XSL_VERSION).zip && \
317 mv -v docbook-xsl-$(XSL_VERSION) docbook-xsl && \
318 $(RM) docbook-xsl-$(XSL_VERSION).zip
319 grep '<fm:Version>' docbook-xsl/VERSION
320
321 IMPNOTES_SRC = impnotes-src
322 $(IMPNOTES_SRC).zip : Makefile impnotes.xml clisp.xml clisp-link.xml \
323 $(IMPNOTES) $(CLISP_XSL) $(CLISP_CSS)
324 $(RM) -r $@ $(IMPNOTES_SRC)
325 mkdir $(IMPNOTES_SRC);
326 for f in $^; do sed 's,\.\./modules/[^/]*/,,' $$f > $(IMPNOTES_SRC)/`basename $$f`; done
327 zip -9mvr $@ $(IMPNOTES_SRC)
328 (test -n "$(DIST)" && $(CHMOD) $@ ../src/NEWS && \
329 $(RSYNC) $@ ../src/NEWS $(DIST)/) || true
330
331 SEARCH=
332 search: force
333 @if test -z "$(SEARCH)"; then echo "usage: make search SEARCH=string"; \
334 else grep -n -- '$(SEARCH)' $(IMPNOTES) $(addsuffix .in, $(IN_FILES)); fi
335
336 force: