source: Makefile@ bb0d80a8

11.3 12.0 12.1 kea ken/TL2024 ken/inkscape-core-mods ken/tuningfonts lazarus lxqt plabs/newcss python3.11 qt5new rahul/power-profiles-daemon renodr/vulkan-addition trunk xry111/llvm18 xry111/xf86-video-removal
Last change on this file since bb0d80a8 was bb0d80a8, checked in by Xi Ruoyao <xry111@…>, 16 months ago

Makefile: fix build-env generation

Not sure why the previous commit with ovbious errors "seems to work"...

  • Property mode set to 100644
File size: 11.8 KB
Line 
1# vim:ts=3
2# Makefile for BLFS Book generation.
3# By Tushar Teredesai <tushar@linuxfromscratch.org>
4# 2004-01-31
5
6# Adjust these to suit your installation
7RENDERTMP ?= $(HOME)/tmp
8CHUNK_QUIET = 1
9ROOT_ID =
10SHELL = /bin/bash
11
12#PYHOSTED = general/prog/python-dependencies/pythonhosted.xml
13#ALLXML := $(filter-out $(RENDERTMP)/%, \
14# $(filter-out $(PYHOSTED), \
15# $(wildcard *.xml */*.xml */*/*.xml */*/*/*.xml */*/*/*/*.xml)))
16ALLXML := $(filter-out $(RENDERTMP)/%, \
17 $(wildcard *.xml */*.xml */*/*.xml */*/*/*.xml */*/*/*/*.xml))
18ALLXSL := $(filter-out $(RENDERTMP)/%, \
19 $(wildcard *.xsl */*.xsl */*/*.xsl */*/*/*.xsl */*/*/*/*.xsl))
20
21ifdef V
22 Q =
23else
24 Q = @
25endif
26
27ifndef REV
28 REV = sysv
29endif
30
31ifneq ($(REV), sysv)
32 ifneq ($(REV), systemd)
33 $(error REV must be 'sysv' (default) or 'systemd'.)
34 endif
35endif
36
37ifeq ($(REV), sysv)
38 BASEDIR ?= $(HOME)/public_html/blfs-book
39 NOCHUNKS_OUTPUT ?= blfs-book.html
40 DUMPDIR ?= ~/blfs-commands
41 BLFSHTML ?= blfs-html.xml
42 BLFSHTML2 ?= blfs-html2.xml
43 BLFSFULL ?= blfs-full.xml
44else
45 BASEDIR ?= $(HOME)/public_html/blfs-systemd
46 NOCHUNKS_OUTPUT ?= blfs-sysd-book.html
47 DUMPDIR ?= ~/blfs-sysd-commands
48 BLFSHTML ?= blfs-systemd-html.xml
49 BLFSHTML2 ?= blfs-systemd-html2.xml
50 BLFSFULL ?= blfs-systemd-full.xml
51
52endif
53
54blfs: html wget-list
55
56help:
57 @echo ""
58 @echo "make <parameters> <targets>"
59 @echo ""
60 @echo "Parameters:"
61 @echo " REV=<rev> Build variation of book"
62 @echo " Valid values for REV are:"
63 @echo " * sysv - Build book for SysV"
64 @echo " * systemd - Build book for systemd"
65 @echo " Defaults to 'sysv'"
66 @echo ""
67 @echo " BASEDIR=<dir> Put the output in directory <dir>."
68 @echo " Defaults to"
69 @echo " 'HOME/public_html/blfs-book' if REV=sysv (or unset)"
70 @echo " or to"
71 @echo " 'HOME/public_html/blfs-book-systemd' if REV=systemd"
72 @echo ""
73 @echo " V=<val> If <val> is a non-empty value, all"
74 @echo " steps to produce the output is shown."
75 @echo " Default is unset."
76 @echo ""
77 @echo "Targets:"
78 @echo " help Show this help text."
79 @echo ""
80 @echo " blfs Builds targets 'html' and 'wget-list'."
81 @echo ""
82 @echo " html Builds the HTML pages of the book."
83 @echo ""
84 @echo " wget-list Produces a list of all packages to download."
85 @echo " Output is BASEDIR/wget-list"
86 @echo ""
87 @echo " nochunks Builds the book as a one-pager. The output"
88 @echo " is a large single HTML page containing the"
89 @echo " whole book."
90 @echo ""
91 @echo " Parameter NOCHUNKS_OUTPUT=<filename> controls"
92 @echo " the name of the HTML file."
93 @echo ""
94 @echo " validate Runs validation checks on the XML files."
95 @echo ""
96 @echo " test-links Runs validation checks on URLs in the book."
97 @echo " Produces a file named BASEDIR/bad_urls containing"
98 @echo " URLS which are invalid and a BASEDIR/good_urls"
99 @echo " containing all valid URLs."
100 @echo ""
101
102all: blfs nochunks
103world: all blfs-patch-list dump-commands test-links
104
105html: $(BASEDIR)/index.html
106$(BASEDIR)/index.html: $(RENDERTMP)/$(BLFSHTML)
107 @echo "Generating chunked XHTML files..."
108 $(Q)xsltproc --nonet \
109 --stringparam chunk.quietly $(CHUNK_QUIET) \
110 --stringparam rootid "$(ROOT_ID)" \
111 --stringparam base.dir $(BASEDIR)/ \
112 stylesheets/blfs-chunked.xsl \
113 $(RENDERTMP)/$(BLFSHTML)
114
115 @echo "Copying CSS code and images..."
116 $(Q)if [ ! -e $(BASEDIR)/stylesheets ]; then \
117 mkdir -p $(BASEDIR)/stylesheets; \
118 fi;
119
120 $(Q)cp stylesheets/lfs-xsl/*.css $(BASEDIR)/stylesheets
121 $(Q)sed -i 's|../stylesheet|stylesheet|' $(BASEDIR)/index.html
122
123 $(Q)if [ ! -e $(BASEDIR)/images ]; then \
124 mkdir -p $(BASEDIR)/images; \
125 fi;
126 $(Q)cp images/*.png $(BASEDIR)/images
127
128 $(Q)cd $(BASEDIR)/; sed -e "s@../images@images@g" \
129 -i *.html
130
131 @echo "Running Tidy and obfuscate.sh on chunked XHTML..."
132 $(Q)for filename in `find $(BASEDIR) -name "*.html"`; do \
133 tidy -config tidy.conf $$filename; \
134 true; \
135 bash obfuscate.sh $$filename; \
136 sed -i -e "1,20s@text/html@application/xhtml+xml@g" $$filename; \
137 done;
138
139nochunks: $(BASEDIR)/$(NOCHUNKS_OUTPUT)
140$(BASEDIR)/$(NOCHUNKS_OUTPUT): $(RENDERTMP)/$(BLFSHTML)
141 @echo "Generating non-chunked XHTML file..."
142 $(Q)xsltproc --nonet \
143 --stringparam rootid "$(ROOT_ID)" \
144 --output $(BASEDIR)/$(NOCHUNKS_OUTPUT) \
145 stylesheets/blfs-nochunks.xsl \
146 $(RENDERTMP)/$(BLFSHTML)
147
148 @echo "Running Tidy and obfuscate.sh on non-chunked XHTML..."
149 $(Q)tidy -config tidy.conf $(BASEDIR)/$(NOCHUNKS_OUTPUT) || true
150 $(Q)bash obfuscate.sh $(BASEDIR)/$(NOCHUNKS_OUTPUT)
151 $(Q)sed -i -e "1,20s@text/html@application/xhtml+xml@g" $(BASEDIR)/$(NOCHUNKS_OUTPUT)
152
153tmpdir: $(RENDERTMP)
154$(RENDERTMP):
155 @echo "Creating $(RENDERTMP)"
156 $(Q)[ -d $(RENDERTMP) ] || mkdir -p $(RENDERTMP)
157
158clean:
159 @echo "Cleaning $(RENDERTMP)"
160 $(Q)rm -f $(RENDERTMP)/blfs*
161
162validate: $(RENDERTMP)/$(BLFSFULL)
163#$(RENDERTMP)/$(BLFSFULL): $(PYHOSTED) version.ent
164$(RENDERTMP)/$(BLFSFULL): version.ent
165 $(Q)[ -d $(RENDERTMP) ] || mkdir -p $(RENDERTMP)
166
167 @echo "Adjusting for revision $(REV)..."
168 $(Q)xsltproc --nonet \
169 --xinclude \
170 --output $(RENDERTMP)/$(BLFSHTML2) \
171 --stringparam profile.revision $(REV) \
172 stylesheets/lfs-xsl/profile.xsl \
173 index.xml
174
175 @echo "Validating the book..."
176 $(Q)xmllint --nonet \
177 --noent \
178 --postvalid \
179 --output $(RENDERTMP)/$(BLFSFULL) \
180 $(RENDERTMP)/$(BLFSHTML2)
181
182profile-html: $(RENDERTMP)/$(BLFSHTML)
183$(RENDERTMP)/$(BLFSHTML): $(RENDERTMP)/$(BLFSFULL)
184 @echo "Generating profiled XML for XHTML..."
185 $(Q)xsltproc --nonet \
186 --stringparam profile.condition html \
187 --output $(RENDERTMP)/$(BLFSHTML) \
188 stylesheets/lfs-xsl/profile.xsl \
189 $(RENDERTMP)/$(BLFSFULL)
190
191blfs-patch-list: blfs-patches.sh
192 @echo "Generating blfs patch list..."
193 $(Q)awk '{if ($$1 == "copy") {sub(/.*\//, "", $$2); print $$2}}' \
194 blfs-patches.sh > blfs-patch-list
195
196blfs-patches.sh: $(RENDERTMP)/$(BLFSFULL)
197 @echo "Generating blfs patch script..."
198 $(Q)xsltproc --nonet \
199 --output blfs-patches.sh \
200 stylesheets/patcheslist.xsl \
201 $(RENDERTMP)/$(BLFSFULL)
202
203wget-list: $(BASEDIR)/wget-list
204$(BASEDIR)/wget-list: $(RENDERTMP)/$(BLFSFULL)
205 @echo "Generating wget list for $(REV) at $(BASEDIR)/wget-list ..."
206 $(Q)mkdir -p $(BASEDIR)
207 $(Q)xsltproc --nonet \
208 --output $(BASEDIR)/wget-list \
209 stylesheets/wget-list.xsl \
210 $(RENDERTMP)/$(BLFSFULL)
211
212test-links: $(BASEDIR)/test-links
213$(BASEDIR)/test-links: $(RENDERTMP)/$(BLFSFULL)
214 @echo "Generating test-links file..."
215 $(Q)mkdir -p $(BASEDIR)
216 $(Q)xsltproc --nonet \
217 --stringparam list_mode full \
218 --output $(BASEDIR)/test-links \
219 stylesheets/wget-list.xsl \
220 $(RENDERTMP)/$(BLFSFULL)
221
222 @echo "Checking URLs, first pass..."
223 $(Q)rm -f $(BASEDIR)/{good,bad,true_bad}_urls
224 $(Q)for URL in `cat $(BASEDIR)/test-links`; do \
225 wget --spider --tries=2 --timeout=60 $$URL >>/dev/null 2>&1; \
226 if test $$? -ne 0 ; then \
227 echo $$URL >> $(BASEDIR)/bad_urls ; \
228 else \
229 echo $$URL >> $(BASEDIR)/good_urls 2>&1; \
230 fi; \
231 done
232
233 @echo "Checking URLs, second pass..."
234 $(Q)for URL2 in `cat $(BASEDIR)/bad_urls`; do \
235 wget --spider --tries=2 --timeout=60 $$URL2 >>/dev/null 2>&1; \
236 if test $$? -ne 0 ; then \
237 echo $$URL2 >> $(BASEDIR)/true_bad_urls ; \
238 else \
239 echo $$URL2 >> $(BASEDIR)/good_urls 2>&1; \
240 fi; \
241 done
242
243bootscripts:
244 @VERSION=`grep "bootscripts-version " general.ent | cut -d\" -f2`; \
245 BOOTSCRIPTS="blfs-bootscripts-$$VERSION"; \
246 if [ ! -e $$BOOTSCRIPTS.tar.xz ]; then \
247 rm -rf $(RENDERTMP)/$$BOOTSCRIPTS; \
248 mkdir $(RENDERTMP)/$$BOOTSCRIPTS; \
249 cp -a ../bootscripts/* $(RENDERTMP)/$$BOOTSCRIPTS; \
250 rm -rf ../bootscripts/archive; \
251 tar -cJhf $$BOOTSCRIPTS.tar.xz -C $(RENDERTMP) $$BOOTSCRIPTS; \
252 fi
253
254systemd-units:
255 @VERSION=`grep "systemd-units-version " general.ent | cut -d\" -f2`; \
256 UNITS="blfs-systemd-units-$$VERSION"; \
257 if [ ! -e $$UNITS.tar.xz ]; then \
258 rm -rf $(RENDERTMP)/$$UNITS; \
259 mkdir $(RENDERTMP)/$$UNITS; \
260 cp -a ../systemd-units/* $(RENDERTMP)/$$UNITS; \
261 tar -cJhf $$UNITS.tar.xz -C $(RENDERTMP) $$UNITS; \
262 fi
263
264dump-commands: $(DUMPDIR)
265$(DUMPDIR): $(RENDERTMP)/$(BLFSFULL)
266 @echo "Dumping book commands..."
267 $(Q)xsltproc --output $(DUMPDIR)/ \
268 stylesheets/dump-commands.xsl \
269 $(RENDERTMP)/$(BLFSFULL)
270 $(Q)touch $(DUMPDIR)
271
272.PHONY: blfs all world html nochunks tmpdir clean \
273 validate profile-html blfs-patch-list wget-list \
274 test-links dump-commands bootscripts systemd-units
275
276version.ent: general.ent packages.ent gnome.ent $(ALLXML) $(ALLXSL) build-env
277 $(Q)./git-version.sh $(REV)
278
279#ALL_PYTHON_DEPS := $(filter-out $(PYHOSTED), \
280# $(wildcard general/prog/python-dependencies/*.xml))
281#
282#PYTHONHOSTED_MODS := requests sphinx_rtd_theme pytest gi-docgen
283#
284#PYTHONHOSTED_MOD_PAGES := $(addprefix general/prog/python-modules/,\
285# $(addsuffix .xml,$(PYTHONHOSTED_MODS)))
286#
287#$(PYHOSTED): $(ALL_PYTHON_DEPS) \
288# $(PYTHONHOSTED_MOD_PAGES) \
289# stylesheets/pyhosted-inc.xsl \
290# stylesheets/pythonhosted.xsl | version.ent
291# @echo Generating pythonhosted.xml; \
292# if [ ! -f $@ ]; then \
293# cp dummy.xml $(PYHOSTED); \
294# fi
295# $(Q)xsltproc --xinclude \
296# --output temp.xml \
297# --stringparam packages "$(PYTHONHOSTED_MODS)" \
298# stylesheets/pythonhosted.xsl \
299# general/prog/python-modules.xml
300# $(Q)mv temp.xml $@
301
302build-env: update-build-env
303 $(Q)echo REV=$(REV) > build-env.new
304 $(Q)echo BASEDIR=$(BASEDIR) >> build-env.new
305 $(Q)diff build-env{.new,} 2>/dev/null >/dev/null || mv build-env{.new,}
306 $(Q)rm -f build-env.new
307
308.PHONY: update-build-env
309update-build-env: ; @true
Note: See TracBrowser for help on using the repository browser.