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