source: Makefile@ 6c4a91a8

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

tidy up Makefile new part

Use the PYHOSTED variable
use $(Q) instead of @

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