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