1 | BASEDIR=~/lfs-book
|
---|
2 | CHUNK_QUIET=0
|
---|
3 | PDF_OUTPUT=LFS-BOOK.pdf
|
---|
4 | NOCHUNKS_OUTPUT=LFS-BOOK.html
|
---|
5 | XSLROOTDIR=/usr/share/xml/docbook/xsl-stylesheets-current
|
---|
6 | TIDY=/home/manuel/bin/lfs-tidy
|
---|
7 |
|
---|
8 | lfs:
|
---|
9 | xsltproc --xinclude --nonet -stringparam profile.condition html \
|
---|
10 | --output $(BASEDIR)/lfs-html.xml stylesheets/lfs-profile.xsl index.xml
|
---|
11 |
|
---|
12 | xsltproc --nonet -stringparam chunk.quietly $(CHUNK_QUIET) \
|
---|
13 | -stringparam base.dir $(BASEDIR)/ stylesheets/lfs-chunked.xsl \
|
---|
14 | $(BASEDIR)/lfs-html.xml
|
---|
15 |
|
---|
16 | if [ ! -e $(BASEDIR)/stylesheets ]; then \
|
---|
17 | mkdir -p $(BASEDIR)/stylesheets; \
|
---|
18 | fi;
|
---|
19 | cp stylesheets/*.css $(BASEDIR)/stylesheets
|
---|
20 |
|
---|
21 | if [ ! -e $(BASEDIR)/images ]; then \
|
---|
22 | mkdir -p $(BASEDIR)/images; \
|
---|
23 | fi;
|
---|
24 | cp $(XSLROOTDIR)/images/*.png \
|
---|
25 | $(BASEDIR)/images
|
---|
26 | cd $(BASEDIR)/; sed -i -e "s@../stylesheets@stylesheets@g" \
|
---|
27 | *.html
|
---|
28 | cd $(BASEDIR)/; sed -i -e "s@../images@images@g" \
|
---|
29 | *.html
|
---|
30 |
|
---|
31 | rm $(BASEDIR)/lfs-html.xml
|
---|
32 |
|
---|
33 | for filename in `find $(BASEDIR) -name "*.html"`; do \
|
---|
34 | $(TIDY) -config tidy.conf $$filename; \
|
---|
35 | true; \
|
---|
36 | done;
|
---|
37 |
|
---|
38 | for filename in `find $(BASEDIR) -name "*.html"`; do \
|
---|
39 | sed -i -e "s@text/html@application/xhtml+xml@g" $$filename; \
|
---|
40 | done;
|
---|
41 |
|
---|
42 | #
|
---|
43 | # This is the old "pdf" target. The old "print" target below has been
|
---|
44 | # renamed to "pdf" and will be used. This commented out previous_pdf
|
---|
45 | # target can be removed eventually. It'll remain here for a bit for
|
---|
46 | # historical reasons
|
---|
47 | #
|
---|
48 | #previous_pdf:
|
---|
49 | # xsltproc --xinclude --nonet --output $(BASEDIR)/lfs.fo stylesheets/lfs-pdf.xsl \
|
---|
50 | # index.xml
|
---|
51 | # sed -i -e "s/inherit/all/" $(BASEDIR)/lfs.fo
|
---|
52 | # fop.sh $(BASEDIR)/lfs.fo $(BASEDIR)/$(PDF_OUTPUT)
|
---|
53 | # rm lfs.fo
|
---|
54 |
|
---|
55 | pdf:
|
---|
56 | xsltproc --xinclude --nonet --stringparam profile.condition pdf \
|
---|
57 | --output $(BASEDIR)/lfs-pdf.xml stylesheets/lfs-profile.xsl index.xml
|
---|
58 | xsltproc --nonet --output $(BASEDIR)/lfs-pdf.fo stylesheets/lfs-pdf.xsl \
|
---|
59 | $(BASEDIR)/lfs-pdf.xml
|
---|
60 | sed -i -e "s/inherit/all/" $(BASEDIR)/lfs-pdf.fo
|
---|
61 | fop.sh $(BASEDIR)/lfs-pdf.fo $(BASEDIR)/$(PDF_OUTPUT)
|
---|
62 | rm $(BASEDIR)/lfs-pdf.xml $(BASEDIR)/lfs-pdf.fo
|
---|
63 |
|
---|
64 | nochunks:
|
---|
65 | xsltproc --xinclude --nonet -stringparam profile.condition html \
|
---|
66 | --output $(BASEDIR)/lfs-nochunk.xml stylesheets/lfs-profile.xsl index.xml
|
---|
67 |
|
---|
68 | xsltproc --nonet --output $(BASEDIR)/$(NOCHUNKS_OUTPUT) \
|
---|
69 | stylesheets/lfs-nochunks.xsl $(BASEDIR)/lfs-nochunk.xml
|
---|
70 |
|
---|
71 | rm $(BASEDIR)/lfs-nochunk.xml
|
---|
72 |
|
---|
73 | $(TIDY) -config tidy.conf $(BASEDIR)/$(NOCHUNKS_OUTPUT) || true
|
---|
74 |
|
---|
75 | sed -i -e "s@text/html@application/xhtml+xml@g" \
|
---|
76 | $(BASEDIR)/$(NOCHUNKS_OUTPUT)
|
---|
77 |
|
---|
78 | validate:
|
---|
79 | xmllint --noout --nonet --xinclude --postvalid index.xml
|
---|
80 |
|
---|