1 | BASEDIR = ~/lfs-book
|
---|
2 | SYSDDIR = ~/lfs-systemd
|
---|
3 | DUMPDIR = ~/lfs-commands
|
---|
4 | RENDERTMP = $(HOME)/tmp
|
---|
5 | CHUNK_QUIET = 1
|
---|
6 | ROOT_ID =
|
---|
7 | PDF_OUTPUT = LFS-BOOK.pdf
|
---|
8 | PDF_SYSD_OUTPUT = LFS-SYSD-BOOK.pdf
|
---|
9 | NOCHUNKS_OUTPUT = LFS-BOOK.html
|
---|
10 | NOCHUNKS_SYSD_FILE = LFS-SYSD-BOOK.html
|
---|
11 | SHELL = /bin/bash
|
---|
12 |
|
---|
13 | ifdef V
|
---|
14 | Q =
|
---|
15 | else
|
---|
16 | Q = @
|
---|
17 | endif
|
---|
18 |
|
---|
19 | sysv: validate profile-html
|
---|
20 | $(Q)xsltproc --nonet \
|
---|
21 | --output $(RENDERTMP)/lfs-html2.xml \
|
---|
22 | --stringparam profile.revision sysv \
|
---|
23 | stylesheets/lfs-xsl/profile.xsl \
|
---|
24 | $(RENDERTMP)/lfs-html.xml
|
---|
25 |
|
---|
26 | @echo "Generating chunked XHTML files..."
|
---|
27 | $(Q)xsltproc --nonet \
|
---|
28 | --stringparam chunk.quietly $(CHUNK_QUIET) \
|
---|
29 | --stringparam rootid "$(ROOT_ID)" \
|
---|
30 | --stringparam base.dir $(BASEDIR)/ \
|
---|
31 | stylesheets/lfs-chunked.xsl \
|
---|
32 | $(RENDERTMP)/lfs-html2.xml
|
---|
33 |
|
---|
34 | @echo "Copying CSS code and images..."
|
---|
35 | $(Q)mkdir -p $(BASEDIR)/stylesheets
|
---|
36 | $(Q)cp stylesheets/lfs-xsl/*.css $(BASEDIR)/stylesheets
|
---|
37 | $(Q)pushd $(BASEDIR)/ > /dev/null; \
|
---|
38 | sed -i -e "s@../stylesheets@stylesheets@g" *.html; \
|
---|
39 | popd > /dev/null
|
---|
40 |
|
---|
41 | $(Q)mkdir -p $(BASEDIR)/images
|
---|
42 | $(Q)cp images/*.png $(BASEDIR)/images
|
---|
43 |
|
---|
44 | @echo "Running Tidy and obfuscate.sh..."
|
---|
45 | $(Q)for filename in `find $(BASEDIR) -name "*.html"`; do \
|
---|
46 | tidy -config tidy.conf $$filename; \
|
---|
47 | true; \
|
---|
48 | /bin/bash obfuscate.sh $$filename; \
|
---|
49 | sed -e "s@text/html@application/xhtml+xml@g" \
|
---|
50 | -e "s/\xa9/\©/ " \
|
---|
51 | -i $$filename; \
|
---|
52 | done;
|
---|
53 |
|
---|
54 | $(Q)$(MAKE) --no-print-directory wget-list md5sums
|
---|
55 |
|
---|
56 | systemd: validated profile-html
|
---|
57 | $(Q)xsltproc --nonet \
|
---|
58 | --output $(RENDERTMP)/lfs-html2.xml \
|
---|
59 | --stringparam profile.revision systemd \
|
---|
60 | stylesheets/lfs-xsl/profile.xsl \
|
---|
61 | $(RENDERTMP)/lfs-html.xml
|
---|
62 |
|
---|
63 | @echo "Generating chunked XHTML files..."
|
---|
64 | $(Q)xsltproc --nonet \
|
---|
65 | --stringparam chunk.quietly $(CHUNK_QUIET) \
|
---|
66 | --stringparam rootid "$(ROOT_ID)" \
|
---|
67 | --stringparam base.dir $(SYSDDIR)/ \
|
---|
68 | stylesheets/lfs-chunked.xsl \
|
---|
69 | $(RENDERTMP)/lfs-html2.xml
|
---|
70 |
|
---|
71 | @echo "Copying CSS code and images..."
|
---|
72 | $(Q)mkdir -p $(SYSDDIR)/stylesheets
|
---|
73 | $(Q)cp stylesheets/lfs-xsl/*.css $(SYSDDIR)/stylesheets
|
---|
74 |
|
---|
75 | $(Q)mkdir -p $(SYSDDIR)/images
|
---|
76 | $(Q)cp images/*.png $(SYSDDIR)/images
|
---|
77 |
|
---|
78 | @echo "Running Tidy and obfuscate.sh..."
|
---|
79 | $(Q)for filename in `find $(SYSDDIR) -name "*.html"`; do \
|
---|
80 | tidy -config tidy.conf $$filename; \
|
---|
81 | true; \
|
---|
82 | /bin/bash obfuscate.sh $$filename; \
|
---|
83 | sed -e "s@text/html@application/xhtml+xml@g" \
|
---|
84 | -e "s/\xa9/\©/ " \
|
---|
85 | -i $$filename; \
|
---|
86 | done;
|
---|
87 |
|
---|
88 | $(Q)$(MAKE) --no-print-directory wget-listd md5sumsd
|
---|
89 |
|
---|
90 | pdf: validate
|
---|
91 | @echo "Generating profiled XML for PDF..."
|
---|
92 | $(Q)xsltproc --nonet \
|
---|
93 | --stringparam profile.condition pdf \
|
---|
94 | --stringparam profile.revision sysv \
|
---|
95 | --output $(RENDERTMP)/lfs-pdf.xml \
|
---|
96 | stylesheets/lfs-xsl/profile.xsl \
|
---|
97 | $(RENDERTMP)/lfs-full.xml
|
---|
98 |
|
---|
99 | @echo "Generating FO file..."
|
---|
100 | $(Q)xsltproc --nonet \
|
---|
101 | --stringparam rootid "$(ROOT_ID)" \
|
---|
102 | --output $(RENDERTMP)/lfs-pdf.fo \
|
---|
103 | stylesheets/lfs-pdf.xsl \
|
---|
104 | $(RENDERTMP)/lfs-pdf.xml
|
---|
105 |
|
---|
106 | $(Q)sed -i -e 's/span="inherit"/span="all"/' $(RENDERTMP)/lfs-pdf.fo
|
---|
107 | $(Q)bash pdf-fixups.sh $(RENDERTMP)/lfs-pdf.fo
|
---|
108 |
|
---|
109 | @echo "Generating PDF file..."
|
---|
110 | $(Q)mkdir -p $(BASEDIR)
|
---|
111 |
|
---|
112 | $(Q)fop -q $(RENDERTMP)/lfs-pdf.fo $(BASEDIR)/$(PDF_OUTPUT) 2>fop.log
|
---|
113 | @echo "$(BASEDIR)/$(PDF_OUTPUT) created"
|
---|
114 | @echo "fop.log created"
|
---|
115 |
|
---|
116 | pdfd: validated
|
---|
117 | @echo "Generating profiled XML for PDF..."
|
---|
118 | $(Q)xsltproc --nonet \
|
---|
119 | --stringparam profile.condition pdf \
|
---|
120 | --stringparam profile.revision systemd \
|
---|
121 | --output $(RENDERTMP)/lfs-pdf.xml \
|
---|
122 | stylesheets/lfs-xsl/profile.xsl \
|
---|
123 | $(RENDERTMP)/lfs-full.xml
|
---|
124 |
|
---|
125 | @echo "Generating FO file..."
|
---|
126 | $(Q)xsltproc --nonet \
|
---|
127 | --stringparam rootid "$(ROOT_ID)" \
|
---|
128 | --output $(RENDERTMP)/lfs-pdf.fo \
|
---|
129 | stylesheets/lfs-pdf.xsl \
|
---|
130 | $(RENDERTMP)/lfs-pdf.xml
|
---|
131 |
|
---|
132 | $(Q)sed -i -e 's/span="inherit"/span="all"/' $(RENDERTMP)/lfs-pdf.fo
|
---|
133 | $(Q)bash pdf-fixups.sh $(RENDERTMP)/lfs-pdf.fo
|
---|
134 |
|
---|
135 | @echo "Generating PDF file..."
|
---|
136 | $(Q)mkdir -p $(SYSDDIR)
|
---|
137 |
|
---|
138 | $(Q)fop -q $(RENDERTMP)/lfs-pdf.fo $(SYSDDIR)/$(PDF_SYSD_OUTPUT) 2>fop.log
|
---|
139 | @echo "$(SYSDDIR)/$(PDF_SYSD_OUTPUT) created"
|
---|
140 | @echo "fop.log created"
|
---|
141 |
|
---|
142 | nochunks: validate profile-html
|
---|
143 | $(Q)xsltproc --nonet \
|
---|
144 | --output $(RENDERTMP)/lfs-html2.xml \
|
---|
145 | --stringparam profile.revision sysv \
|
---|
146 | stylesheets/lfs-xsl/profile.xsl \
|
---|
147 | $(RENDERTMP)/lfs-html.xml
|
---|
148 |
|
---|
149 | @echo "Generating non chunked XHTML file..."
|
---|
150 | $(Q)xsltproc --nonet \
|
---|
151 | --stringparam rootid "$(ROOT_ID)" \
|
---|
152 | --output $(BASEDIR)/$(NOCHUNKS_OUTPUT) \
|
---|
153 | stylesheets/lfs-nochunks.xsl \
|
---|
154 | $(RENDERTMP)/lfs-html2.xml
|
---|
155 |
|
---|
156 | @echo "Running Tidy..."
|
---|
157 | $(Q)tidy -config tidy.conf $(BASEDIR)/$(NOCHUNKS_OUTPUT) || true
|
---|
158 |
|
---|
159 | @echo "Running obfuscate.sh..."
|
---|
160 | $(Q)bash obfuscate.sh $(BASEDIR)/$(NOCHUNKS_OUTPUT)
|
---|
161 | $(Q)sed -i -e "s@text/html@application/xhtml+xml@g" $(BASEDIR)/$(NOCHUNKS_OUTPUT)
|
---|
162 | $(Q)sed -i -e "s@../wget-list@wget-list@" $(BASEDIR)/$(NOCHUNKS_OUTPUT)
|
---|
163 | $(Q)sed -i -e "s@../md5sums@md5sums@" $(BASEDIR)/$(NOCHUNKS_OUTPUT)
|
---|
164 | $(Q)sed -i -e "s@\xa9@\©@" $(BASEDIR)/$(NOCHUNKS_OUTPUT)
|
---|
165 |
|
---|
166 | @echo "Output at $(BASEDIR)/$(NOCHUNKS_OUTPUT)"
|
---|
167 |
|
---|
168 | nochunksd: validated profile-html
|
---|
169 | $(Q)xsltproc --nonet \
|
---|
170 | --output $(RENDERTMP)/lfs-html2.xml \
|
---|
171 | --stringparam profile.revision systemd \
|
---|
172 | stylesheets/lfs-xsl/profile.xsl \
|
---|
173 | $(RENDERTMP)/lfs-html.xml
|
---|
174 |
|
---|
175 | @echo "Generating non chunked XHTML file..."
|
---|
176 | $(Q)xsltproc --nonet \
|
---|
177 | --stringparam rootid "$(ROOT_ID)" \
|
---|
178 | --output $(SYSDDIR)/$(NOCHUNKS_SYSD_FILE) \
|
---|
179 | stylesheets/lfs-nochunks.xsl \
|
---|
180 | $(RENDERTMP)/lfs-html2.xml
|
---|
181 |
|
---|
182 | @echo "Running Tidy..."
|
---|
183 | $(Q)tidy -config tidy.conf $(SYSDDIR)/$(NOCHUNKS_SYSD_FILE) || true
|
---|
184 |
|
---|
185 | @echo "Running obfuscate.sh..."
|
---|
186 | $(Q)bash obfuscate.sh $(SYSDDIR)/$(NOCHUNKS_SYSD_FILE)
|
---|
187 | $(Q)sed -i -e "s@text/html@application/xhtml+xml@g" $(SYSDDIR)/$(NOCHUNKS_SYSD_FILE)
|
---|
188 | $(Q)sed -i -e "s@../wget-list@wget-list@" $(SYSDDIR)/$(NOCHUNKS_SYSD_FILE)
|
---|
189 | $(Q)sed -i -e "s@../md5sums@md5sums@" $(SYSDDIR)/$(NOCHUNKS_SYSD_FILE)
|
---|
190 | $(Q)sed -i -e "s@\xa9@\©@" $(SYSDDIR)/$(NOCHUNKS_SYSD_FILE)
|
---|
191 |
|
---|
192 | @echo "Output at $(SYSDDIR)/$(NOCHUNKS_SYSD_FILE)"
|
---|
193 |
|
---|
194 | tmpdir:
|
---|
195 | @echo "Creating and cleaning $(RENDERTMP)"
|
---|
196 | $(Q)mkdir -p $(RENDERTMP)
|
---|
197 | $(Q)rm -f $(RENDERTMP)/lfs*.xml
|
---|
198 | $(Q)rm -f $(RENDERTMP)/sysd*.xml
|
---|
199 | $(Q)rm -f $(RENDERTMP)/*pdf.fo
|
---|
200 |
|
---|
201 | validate: tmpdir
|
---|
202 | @echo "Processing bootscripts..."
|
---|
203 | $(Q)bash process-scripts.sh
|
---|
204 | @echo "Validating the book..."
|
---|
205 | $(Q)xmllint --nonet \
|
---|
206 | --noent \
|
---|
207 | --xinclude \
|
---|
208 | --postvalid \
|
---|
209 | -o $(RENDERTMP)/lfs-full.xml \
|
---|
210 | index.xml
|
---|
211 | $(Q)rm -f appendices/*.script
|
---|
212 | $(Q)./aux-file-data.sh $(RENDERTMP)/lfs-full.xml
|
---|
213 | @echo "Validation complete."
|
---|
214 |
|
---|
215 | validated: tmpdir
|
---|
216 | @echo "Validating the book..."
|
---|
217 | $(Q)xmllint --nonet \
|
---|
218 | --noent \
|
---|
219 | --xinclude \
|
---|
220 | --postvalid \
|
---|
221 | -o $(RENDERTMP)/lfs-full.xml \
|
---|
222 | indexd.xml
|
---|
223 | @echo "Validation complete."
|
---|
224 |
|
---|
225 | profile-html:
|
---|
226 | @echo "Generating profiled XML for XHTML..."
|
---|
227 | $(Q)xsltproc --nonet \
|
---|
228 | --stringparam profile.condition html \
|
---|
229 | --output $(RENDERTMP)/lfs-html.xml \
|
---|
230 | stylesheets/lfs-xsl/profile.xsl \
|
---|
231 | $(RENDERTMP)/lfs-full.xml
|
---|
232 |
|
---|
233 | wget-list: $(BASEDIR)/wget-list
|
---|
234 | $(BASEDIR)/wget-list: stylesheets/wget-list.xsl chapter03/chapter03.xml \
|
---|
235 | packages.ent patches.ent
|
---|
236 | @echo "Generating wget list for sysv..."
|
---|
237 | $(Q)mkdir -p $(BASEDIR)
|
---|
238 |
|
---|
239 | $(Q)xsltproc --nonet --xinclude \
|
---|
240 | --stringparam profile.revision sysv \
|
---|
241 | --output $(RENDERTMP)/sysd-wget.xml \
|
---|
242 | stylesheets/lfs-xsl/profile.xsl \
|
---|
243 | chapter03/chapter03.xml
|
---|
244 |
|
---|
245 | $(Q)xsltproc --xinclude --nonet \
|
---|
246 | --output $(BASEDIR)/wget-list \
|
---|
247 | stylesheets/wget-list.xsl \
|
---|
248 | chapter03/chapter03.xml
|
---|
249 |
|
---|
250 | wget-listd: $(SYSDDIR)/wget-listd
|
---|
251 | $(SYSDDIR)/wget-listd: stylesheets/wget-list.xsl chapter03/chapter03.xml \
|
---|
252 | packages.ent patches.ent
|
---|
253 | @echo "Generating wget list for systemd..."
|
---|
254 | $(Q)mkdir -p $(SYSDDIR)
|
---|
255 |
|
---|
256 | $(Q)xsltproc --xinclude --nonet \
|
---|
257 | --stringparam profile.revision systemd \
|
---|
258 | --output $(RENDERTMP)/sysd-wget.xml \
|
---|
259 | stylesheets/lfs-xsl/profile.xsl \
|
---|
260 | chapter03/chapter03.xml
|
---|
261 |
|
---|
262 | $(Q)xsltproc --xinclude --nonet \
|
---|
263 | --output $(SYSDDIR)/wget-list \
|
---|
264 | stylesheets/wget-list.xsl \
|
---|
265 | $(RENDERTMP)/sysd-wget.xml
|
---|
266 |
|
---|
267 | md5sums: $(BASEDIR)/md5sums
|
---|
268 | $(BASEDIR)/md5sums: stylesheets/wget-list.xsl chapter03/chapter03.xml \
|
---|
269 | packages.ent patches.ent
|
---|
270 | @echo "Generating md5sum file for sysv..."
|
---|
271 | $(Q)mkdir -p $(BASEDIR)
|
---|
272 |
|
---|
273 | $(Q)xsltproc --nonet --xinclude \
|
---|
274 | --stringparam profile.revision sysv \
|
---|
275 | --output $(RENDERTMP)/sysv-md5sum.xml \
|
---|
276 | stylesheets/lfs-xsl/profile.xsl \
|
---|
277 | chapter03/chapter03.xml
|
---|
278 |
|
---|
279 | $(Q)xsltproc --xinclude --nonet \
|
---|
280 | --output $(BASEDIR)/md5sums \
|
---|
281 | stylesheets/md5sum.xsl \
|
---|
282 | $(RENDERTMP)/sysv-md5sum.xml
|
---|
283 | $(Q)sed -i -e \
|
---|
284 | "s/BOOTSCRIPTS-MD5SUM/$(shell md5sum lfs-bootscripts*.tar.bz2 | cut -d' ' -f1)/" \
|
---|
285 | $(BASEDIR)/md5sums
|
---|
286 |
|
---|
287 | md5sumsd: $(SYSDDIR)/md5sums
|
---|
288 | $(SYSDDIR)/md5sums: stylesheets/wget-list.xsl chapter03/chapter03.xml \
|
---|
289 | packages.ent patches.ent
|
---|
290 | @echo "Generating md5sum file for systemd..."
|
---|
291 | $(Q)mkdir -p $(SYSDDIR)
|
---|
292 | $(Q)xsltproc --nonet --xinclude \
|
---|
293 | --stringparam profile.revision systemd \
|
---|
294 | --output $(RENDERTMP)/sysd-md5sum.xml \
|
---|
295 | stylesheets/lfs-xsl/profile.xsl \
|
---|
296 | chapter03/chapter03.xml
|
---|
297 |
|
---|
298 | $(Q)xsltproc --xinclude --nonet \
|
---|
299 | --output $(SYSDDIR)/md5sums \
|
---|
300 | stylesheets/md5sum.xsl \
|
---|
301 | $(RENDERTMP)/sysd-md5sum.xml
|
---|
302 |
|
---|
303 | dump-commands: validate
|
---|
304 | @echo "Dumping book commands..."
|
---|
305 | $(Q)xsltproc --nonet \
|
---|
306 | --output $(RENDERTMP)/lfs-html.xml \
|
---|
307 | --stringparam profile.revision sysv \
|
---|
308 | stylesheets/lfs-xsl/profile.xsl \
|
---|
309 | $(RENDERTMP)/lfs-full.xml
|
---|
310 |
|
---|
311 | $(Q)rm -rf $(DUMPDIR)
|
---|
312 |
|
---|
313 | $(Q)xsltproc --output $(DUMPDIR)/ \
|
---|
314 | stylesheets/dump-commands.xsl \
|
---|
315 | $(RENDERTMP)/lfs-html.xml
|
---|
316 | @echo "Dumping book commands complete in $(DUMPDIR)"
|
---|
317 |
|
---|
318 | dump-commandsd: validated
|
---|
319 | @echo "Dumping book commands..."
|
---|
320 | $(Q)xsltproc --nonet \
|
---|
321 | --output $(RENDERTMP)/lfs-html.xml \
|
---|
322 | --stringparam profile.revision systemd \
|
---|
323 | stylesheets/lfs-xsl/profile.xsl \
|
---|
324 | $(RENDERTMP)/lfs-full.xml
|
---|
325 |
|
---|
326 | $(Q)rm -rf $(DUMPDIR)
|
---|
327 |
|
---|
328 | $(Q)xsltproc --output $(DUMPDIR)/ \
|
---|
329 | stylesheets/dump-commands.xsl \
|
---|
330 | $(RENDERTMP)/lfs-html.xml
|
---|
331 | @echo "Dumping book commands complete in $(DUMPDIR)"
|
---|
332 |
|
---|
333 | all: lfs nochunks pdf dump-commands
|
---|
334 |
|
---|
335 | .PHONY : all sysv systemd dump-commands lfs nochunks pdf profile-html tmpdir validate
|
---|
336 |
|
---|