source: Makefile@ e15b03b

multilib
Last change on this file since e15b03b was e15b03b, checked in by Thomas Trepl (Moody) <thomas@…>, 22 months ago

Merge upstream

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