source: Makefile@ 2affd83

multilib
Last change on this file since 2affd83 was 8ccf082a, checked in by Thomas Trepl <thomas@…>, 4 months ago

Automatic merge of trunk into multilib

  • Property mode set to 100644
File size: 7.8 KB
Line 
1# vim:ts=3
2RENDERTMP = $(HOME)/tmp
3CHUNK_QUIET = 1
4ROOT_ID =
5SHELL = /bin/bash
6
7ifdef V
8 Q =
9else
10 Q = @
11endif
12
13ifndef REV
14 REV = sysv
15endif
16
17ifneq ($(REV), sysv)
18 ifneq ($(REV), systemd)
19 $(error REV must be 'sysv' (default) or 'systemd'.)
20 endif
21endif
22
23ifeq ($(REV), sysv)
24 BASEDIR ?= $(HOME)/public_html/lfs-book
25 PDF_OUTPUT ?= LFS-BOOK.pdf
26 NOCHUNKS_OUTPUT ?= LFS-BOOK.html
27 DUMPDIR ?= $(HOME)/lfs-commands
28else
29 BASEDIR ?= $(HOME)/public_html/lfs-systemd
30 PDF_OUTPUT ?= LFS-SYSD-BOOK.pdf
31 NOCHUNKS_OUTPUT ?= LFS-SYSD-BOOK.html
32 DUMPDIR ?= $(HOME)/lfs-sysd-commands
33endif
34
35ifndef ARCH
36 ARCH = default
37endif
38ifneq ($(ARCH), default)
39 ifneq ($(ARCH), ml_32)
40 ifneq ($(ARCH), ml_x32)
41 ifneq ($(ARCH), ml_all)
42 $(error ARCH must be either 'default' (default if unset), 'ml_32', 'ml_x32' or 'ml_all'.)
43 endif
44 endif
45 endif
46endif
47
48book: validate profile-html
49 @echo "Generating chunked XHTML files at $(BASEDIR)/ ..."
50 $(Q)xsltproc --nonet \
51 --stringparam chunk.quietly $(CHUNK_QUIET) \
52 --stringparam rootid "$(ROOT_ID)" \
53 --stringparam base.dir $(BASEDIR)/ \
54 stylesheets/lfs-chunked.xsl \
55 $(RENDERTMP)/lfs-html.xml
56
57 @echo "Copying CSS code and images..."
58 $(Q)mkdir -p $(BASEDIR)/stylesheets
59 $(Q)cp stylesheets/lfs-xsl/*.css $(BASEDIR)/stylesheets
60 $(Q)sed -e 's|../stylesheet|stylesheet|' \
61 -i $(BASEDIR)/index.html
62
63 $(Q)mkdir -p $(BASEDIR)/images
64 $(Q)cp images/*.png $(BASEDIR)/images
65
66 @echo "Running Tidy and obfuscate.sh..."
67 $(Q)for filename in `find $(BASEDIR) -name "*.html"`; do \
68 tidy -config tidy.conf $$filename; \
69 /bin/bash obfuscate.sh $$filename; \
70 sed -e "s|text/html|application/xhtml+xml|g" \
71 -i $$filename; \
72 done
73
74 $(Q)$(MAKE) --no-print-directory wget-list md5sums
75
76pdf: validate
77 @echo "Generating profiled XML for PDF..."
78 $(Q)xsltproc --nonet \
79 --stringparam profile.condition pdf \
80 --output $(RENDERTMP)/lfs-pdf.xml \
81 stylesheets/lfs-xsl/profile.xsl \
82 $(RENDERTMP)/lfs-full.xml
83
84 @echo "Generating FO file..."
85 $(Q)xsltproc --nonet \
86 --stringparam rootid "$(ROOT_ID)" \
87 --output $(RENDERTMP)/lfs-pdf.fo \
88 stylesheets/lfs-pdf.xsl \
89 $(RENDERTMP)/lfs-pdf.xml
90
91 $(Q)sed -i -e 's/span="inherit"/span="all"/' $(RENDERTMP)/lfs-pdf.fo
92 $(Q)bash pdf-fixups.sh $(RENDERTMP)/lfs-pdf.fo
93
94 @echo "Generating PDF file..."
95 $(Q)mkdir -p $(RENDERTMP)/images
96 $(Q)cp images/*.png $(RENDERTMP)/images
97
98 $(Q)mkdir -p $(BASEDIR)
99
100 $(Q)fop -q $(RENDERTMP)/lfs-pdf.fo $(BASEDIR)/$(PDF_OUTPUT) 2>fop.log
101 @echo "$(BASEDIR)/$(PDF_OUTPUT) created"
102 @echo "fop.log created"
103
104nochunks: validate profile-html
105 @echo "Generating non chunked XHTML file..."
106 $(Q)xsltproc --nonet \
107 --stringparam rootid "$(ROOT_ID)" \
108 --output $(BASEDIR)/$(NOCHUNKS_OUTPUT) \
109 stylesheets/lfs-nochunks.xsl \
110 $(RENDERTMP)/lfs-html.xml
111
112 @echo "Running Tidy..."
113 $(Q)tidy -config tidy.conf $(BASEDIR)/$(NOCHUNKS_OUTPUT) || test $$? -le 1
114
115 @echo "Running obfuscate.sh..."
116 $(Q)bash obfuscate.sh $(BASEDIR)/$(NOCHUNKS_OUTPUT)
117 $(Q)sed -e "s|text/html|application/xhtml+xml|g" \
118 -e "s|../wget-list|wget-list|" \
119 -e "s|../md5sums|md5sums|" \
120 -i $(BASEDIR)/$(NOCHUNKS_OUTPUT)
121
122 @echo "Output at $(BASEDIR)/$(NOCHUNKS_OUTPUT)"
123
124tmpdir:
125 @echo "Creating and cleaning $(RENDERTMP)"
126 $(Q)mkdir -p $(RENDERTMP)
127 $(Q)rm -f $(RENDERTMP)/lfs*.xml
128 $(Q)rm -f $(RENDERTMP)/*wget*
129 $(Q)rm -f $(RENDERTMP)/*md5sum*
130 $(Q)rm -f $(RENDERTMP)/*pdf.fo
131
132validate: tmpdir version
133 @echo "Processing bootscripts..."
134 $(Q)bash process-scripts.sh
135
136 @echo "Adjusting for revision $(REV)..."
137 $(Q)xsltproc --nonet \
138 --xinclude \
139 --stringparam profile.revision $(REV) \
140 --stringparam profile.arch $(ARCH) \
141 --output $(RENDERTMP)/lfs-html2.xml \
142 stylesheets/lfs-xsl/profile.xsl \
143 index.xml
144
145 @echo "Validating the book..."
146 $(Q)xmllint --nonet \
147 --encode UTF-8 \
148 --postvalid \
149 --output $(RENDERTMP)/lfs-full.xml \
150 $(RENDERTMP)/lfs-html2.xml
151
152 $(Q)rm -f appendices/*.script
153 $(Q)./aux-file-data.sh $(RENDERTMP)/lfs-full.xml
154 @echo "Validation complete."
155
156profile-html:
157 @echo "Generating profiled XML for XHTML..."
158 $(Q)xsltproc --nonet \
159 --stringparam profile.condition html \
160 --output $(RENDERTMP)/lfs-html.xml \
161 stylesheets/lfs-xsl/profile.xsl \
162 $(RENDERTMP)/lfs-full.xml
163
164DOWNLOADS_DEP = chapter03/packages.xml chapter03/patches.xml \
165 packages.ent patches.ent general.ent
166
167wget-list: $(BASEDIR)/wget-list $(BASEDIR)/wget-list-$(REV)
168$(BASEDIR)/wget-list: stylesheets/wget-list.xsl $(DOWNLOADS_DEP)
169 @echo "Generating consolidated wget list at $(BASEDIR)/wget-list ..."
170 $(Q)mkdir -p $(BASEDIR)
171 $(Q)xsltproc --nonet \
172 --xinclude \
173 --output $(BASEDIR)/wget-list \
174 stylesheets/wget-list.xsl \
175 chapter03/chapter03.xml
176
177$(BASEDIR)/wget-list-$(REV): stylesheets/wget-list.xsl $(DOWNLOADS_DEP)
178 $(Q)xsltproc --nonet \
179 --xinclude \
180 --stringparam profile.revision $(REV) \
181 --output $(RENDERTMP)/wget-list.xml \
182 stylesheets/lfs-xsl/profile.xsl \
183 chapter03/chapter03.xml
184
185 $(Q)xsltproc --nonet \
186 --output $(BASEDIR)/wget-list-$(REV) \
187 stylesheets/wget-list.xsl \
188 $(RENDERTMP)/wget-list.xml
189
190md5sums: $(BASEDIR)/md5sums
191$(BASEDIR)/md5sums: stylesheets/wget-list.xsl $(DOWNLOADS_DEP)
192 @echo "Generating consolidated md5sum file at $(BASEDIR)/md5sums ..."
193 $(Q)mkdir -p $(BASEDIR)
194
195 $(Q)xsltproc --nonet \
196 --xinclude \
197 --stringparam profile.revision $(REV) \
198 --stringparam profile.arch $(ARCH) \
199 --output $(RENDERTMP)/md5sum.xml \
200 stylesheets/lfs-xsl/profile.xsl \
201 chapter03/chapter03.xml
202
203 $(Q)xsltproc --nonet \
204 --output $(BASEDIR)/md5sums \
205 stylesheets/md5sum.xsl \
206 $(RENDERTMP)/md5sum.xml
207 $(Q)sed -i -e \
208 "s/BOOTSCRIPTS-MD5SUM/$(shell md5sum lfs-bootscripts*.tar.xz | cut -d' ' -f1)/" \
209 $(BASEDIR)/md5sums
210
211version:
212 $(Q)./git-version.sh $(REV)
213
214dump-commands: validate
215 @echo "Dumping book commands..."
216
217 $(Q)rm -rf $(DUMPDIR)
218
219 $(Q)xsltproc --output $(DUMPDIR)/ \
220 stylesheets/dump-commands.xsl \
221 $(RENDERTMP)/lfs-full.xml
222 @echo "Dumping book commands complete in $(DUMPDIR)"
223
224all: book nochunks pdf dump-commands
225
226dist:
227 $(Q)DIST=/tmp/LFS-RELEASE ./git-version.sh $(REV)
228 $(Q)rm -f lfs-$$(</tmp/LFS-RELEASE).tar.xz
229 $(Q)tar cJf lfs-$$(</tmp/LFS-RELEASE).tar.xz \
230 $(shell git ls-tree HEAD . --name-only) version.ent \
231 -C /tmp LFS-RELEASE \
232 --transform "s,^,lfs-$$(</tmp/LFS-RELEASE)/,"
233 $(Q)echo "Generated XML tarball lfs-$$(</tmp/LFS-RELEASE).tar.xz"
234
235.PHONY : all book dump-commands nochunks pdf profile-html tmpdir validate md5sums wget-list version dist
236
Note: See TracBrowser for help on using the repository browser.