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 | ARCH=x86
|
---|
7 |
|
---|
8 | lfs:
|
---|
9 | # top-level index.html
|
---|
10 | xsltproc --nonet --output $(BASEDIR)/index.html stylesheets/top-index.xsl prologue/bookinfo.xml
|
---|
11 |
|
---|
12 | # x86
|
---|
13 | xsltproc --xinclude --nonet -stringparam profile.condition html -stringparam profile.arch x86 \
|
---|
14 | --output $(BASEDIR)/lfs-html.xml stylesheets/lfs-profile.xsl index.xml
|
---|
15 |
|
---|
16 | xsltproc --nonet -stringparam chunk.quietly $(CHUNK_QUIET) \
|
---|
17 | -stringparam base.dir $(BASEDIR)/x86/ stylesheets/lfs-chunked.xsl \
|
---|
18 | $(BASEDIR)/lfs-html.xml
|
---|
19 |
|
---|
20 | if [ ! -e $(BASEDIR)/x86/stylesheets ]; then \
|
---|
21 | mkdir -p $(BASEDIR)/x86/stylesheets; \
|
---|
22 | fi;
|
---|
23 | cp stylesheets/*.css $(BASEDIR)/x86/stylesheets
|
---|
24 |
|
---|
25 | if [ ! -e $(BASEDIR)/x86/images ]; then \
|
---|
26 | mkdir -p $(BASEDIR)/x86/images; \
|
---|
27 | fi;
|
---|
28 | cp $(XSLROOTDIR)/images/*.png \
|
---|
29 | $(BASEDIR)/x86/images
|
---|
30 | cd $(BASEDIR)/x86/; sed -i -e "s@../stylesheets@stylesheets@g" \
|
---|
31 | *.html
|
---|
32 | cd $(BASEDIR)/x86/; sed -i -e "s@../images@images@g" \
|
---|
33 | *.html
|
---|
34 |
|
---|
35 | rm $(BASEDIR)/lfs-html.xml
|
---|
36 |
|
---|
37 | # raq2
|
---|
38 | xsltproc --xinclude --nonet -stringparam profile.condition html -stringparam profile.arch raq2 \
|
---|
39 | --output $(BASEDIR)/lfs-html.xml stylesheets/lfs-profile.xsl index.xml
|
---|
40 |
|
---|
41 | xsltproc --nonet -stringparam chunk.quietly $(CHUNK_QUIET) \
|
---|
42 | -stringparam base.dir $(BASEDIR)/raq2/ stylesheets/lfs-chunked.xsl \
|
---|
43 | $(BASEDIR)/lfs-html.xml
|
---|
44 |
|
---|
45 | if [ ! -e $(BASEDIR)/raq2/stylesheets ]; then \
|
---|
46 | mkdir -p $(BASEDIR)/raq2/stylesheets; \
|
---|
47 | fi;
|
---|
48 | cp stylesheets/*.css $(BASEDIR)/raq2/stylesheets
|
---|
49 |
|
---|
50 | if [ ! -e $(BASEDIR)/raq2/images ]; then \
|
---|
51 | mkdir -p $(BASEDIR)/raq2/images; \
|
---|
52 | fi;
|
---|
53 | cp $(XSLROOTDIR)/images/*.png \
|
---|
54 | $(BASEDIR)/raq2/images
|
---|
55 | cd $(BASEDIR)/raq2/; sed -i -e "s@../stylesheets@stylesheets@g" \
|
---|
56 | *.html
|
---|
57 | cd $(BASEDIR)/raq2/; sed -i -e "s@../images@images@g" \
|
---|
58 | *.html
|
---|
59 |
|
---|
60 | rm $(BASEDIR)/lfs-html.xml
|
---|
61 |
|
---|
62 | # common stuff
|
---|
63 | for filename in `find $(BASEDIR) -name "*.html"`; do \
|
---|
64 | tidy -config tidy.conf $$filename; \
|
---|
65 | true; \
|
---|
66 | done;
|
---|
67 |
|
---|
68 | for filename in `find $(BASEDIR) -name "*.html"`; do \
|
---|
69 | sed -i -e "s@text/html@application/xhtml+xml@g" $$filename; \
|
---|
70 | done;
|
---|
71 |
|
---|
72 | html:
|
---|
73 | xsltproc --xinclude --nonet -stringparam profile.condition html -stringparam profile.arch $(ARCH) \
|
---|
74 | --output $(BASEDIR)/lfs-html.xml stylesheets/lfs-profile.xsl index.xml
|
---|
75 |
|
---|
76 | xsltproc --nonet -stringparam chunk.quietly $(CHUNK_QUIET) \
|
---|
77 | -stringparam base.dir $(BASEDIR)/ stylesheets/lfs-chunked.xsl \
|
---|
78 | $(BASEDIR)/lfs-html.xml
|
---|
79 |
|
---|
80 | if [ ! -e $(BASEDIR)/stylesheets ]; then \
|
---|
81 | mkdir -p $(BASEDIR)/stylesheets; \
|
---|
82 | fi;
|
---|
83 | cp stylesheets/*.css $(BASEDIR)/stylesheets
|
---|
84 |
|
---|
85 | if [ ! -e $(BASEDIR)/images ]; then \
|
---|
86 | mkdir -p $(BASEDIR)/images; \
|
---|
87 | fi;
|
---|
88 | cp $(XSLROOTDIR)/images/*.png \
|
---|
89 | $(BASEDIR)/images
|
---|
90 | cd $(BASEDIR)/; sed -i -e "s@../stylesheets@stylesheets@g" \
|
---|
91 | *.html
|
---|
92 | cd $(BASEDIR)/; sed -i -e "s@../images@images@g" \
|
---|
93 | *.html
|
---|
94 |
|
---|
95 | rm $(BASEDIR)/lfs-html.xml
|
---|
96 |
|
---|
97 | for filename in `find $(BASEDIR) -name "*.html"`; do \
|
---|
98 | tidy -config tidy.conf $$filename; \
|
---|
99 | true; \
|
---|
100 | done;
|
---|
101 |
|
---|
102 | for filename in `find $(BASEDIR) -name "*.html"`; do \
|
---|
103 | sed -i -e "s@text/html@application/xhtml+xml@g" $$filename; \
|
---|
104 | done;
|
---|
105 |
|
---|
106 | #
|
---|
107 | # This is the old "pdf" target. The old "print" target below has been
|
---|
108 | # renamed to "pdf" and will be used. This commented out previous_pdf
|
---|
109 | # target can be removed eventually. It'll remain here for a bit for
|
---|
110 | # historical reasons
|
---|
111 | #
|
---|
112 | #previous_pdf:
|
---|
113 | # xsltproc --xinclude --nonet --output $(BASEDIR)/lfs.fo stylesheets/lfs-pdf.xsl \
|
---|
114 | # index.xml
|
---|
115 | # sed -i -e "s/inherit/all/" $(BASEDIR)/lfs.fo
|
---|
116 | # fop.sh $(BASEDIR)/lfs.fo $(BASEDIR)/$(PDF_OUTPUT)
|
---|
117 | # rm lfs.fo
|
---|
118 |
|
---|
119 | pdf:
|
---|
120 | xsltproc --xinclude --nonet --stringparam profile.condition pdf -stringparam profile.arch $(ARCH) \
|
---|
121 | --output $(BASEDIR)/lfs-pdf.xml stylesheets/lfs-profile.xsl index.xml
|
---|
122 | xsltproc --nonet --output $(BASEDIR)/lfs-pdf.fo stylesheets/lfs-pdf.xsl \
|
---|
123 | $(BASEDIR)/lfs-pdf.xml
|
---|
124 | sed -i -e "s/inherit/all/" $(BASEDIR)/lfs-pdf.fo
|
---|
125 | fop.sh $(BASEDIR)/lfs-pdf.fo $(BASEDIR)/$(PDF_OUTPUT)
|
---|
126 | rm $(BASEDIR)/lfs-pdf.xml $(BASEDIR)/lfs-pdf.fo
|
---|
127 |
|
---|
128 | nochunks:
|
---|
129 | xsltproc --xinclude --nonet -stringparam profile.condition html -stringparam profile.arch $(ARCH) \
|
---|
130 | --output $(BASEDIR)/lfs-nochunk.xml stylesheets/lfs-profile.xsl index.xml
|
---|
131 |
|
---|
132 | xsltproc --nonet --output $(BASEDIR)/$(NOCHUNKS_OUTPUT) \
|
---|
133 | stylesheets/lfs-nochunks.xsl $(BASEDIR)/lfs-nochunk.xml
|
---|
134 |
|
---|
135 | rm $(BASEDIR)/lfs-nochunk.xml
|
---|
136 |
|
---|
137 | tidy -config tidy.conf $(BASEDIR)/$(NOCHUNKS_OUTPUT) || true
|
---|
138 |
|
---|
139 | sed -i -e "s@text/html@application/xhtml+xml@g" \
|
---|
140 | $(BASEDIR)/$(NOCHUNKS_OUTPUT)
|
---|
141 |
|
---|
142 | validate:
|
---|
143 | xmllint --noout --nonet --xinclude --postvalid index.xml
|
---|
144 |
|
---|