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