source: Makefile@ 0632116

multilib xry111/multilib
Last change on this file since 0632116 was 0632116, checked in by Thomas Trepl <thomas@…>, 9 months ago

Automatic merge of trunk into multilib

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