source: Makefile@ b6ad4e0

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 b6ad4e0 was b6ad4e0, checked in by Bruce Dubbs <bdubbs@…>, 15 months ago

Remove warning on first build after clone
Created a new file, dummy.xml, that is copied to
./general/prog/python-dependencies/pythonhosted.xml
if that file does not already exist. This avoids a warning
when generating the book for the first time after
cloning the source from the repository.

  • Property mode set to 100644
File size: 11.4 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
12PYHOSTED = general/prog/python-dependencies/pythonhosted.xml
13ALLXML := $(filter-out $(RENDERTMP)/%, \
14 $(filter-out $(PYHOSTED), \
15 $(wildcard *.xml */*.xml */*/*.xml */*/*/*.xml */*/*/*/*.xml)))
16ALLXSL := $(filter-out $(RENDERTMP)/%, \
17 $(wildcard *.xsl */*.xsl */*/*.xsl */*/*/*.xsl */*/*/*/*.xsl))
18
19
20ifdef V
21 Q =
22else
23 Q = @
24endif
25
26ifndef REV
27 REV = sysv
28endif
29
30ifneq ($(REV), sysv)
31 ifneq ($(REV), systemd)
32 $(error REV must be 'sysv' (default) or 'systemd'.)
33 endif
34endif
35
36ifeq ($(REV), sysv)
37 BASEDIR ?= $(HOME)/public_html/blfs-book
38 NOCHUNKS_OUTPUT ?= blfs-book.html
39 DUMPDIR ?= ~/blfs-commands
40 BLFSHTML ?= blfs-html.xml
41 BLFSHTML2 ?= blfs-html2.xml
42 BLFSFULL ?= blfs-full.xml
43else
44 BASEDIR ?= $(HOME)/public_html/blfs-systemd
45 NOCHUNKS_OUTPUT ?= blfs-sysd-book.html
46 DUMPDIR ?= ~/blfs-sysd-commands
47 BLFSHTML ?= blfs-systemd-html.xml
48 BLFSHTML2 ?= blfs-systemd-html2.xml
49 BLFSFULL ?= blfs-systemd-full.xml
50
51endif
52
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 $(Q)[ -d $(RENDERTMP) ] || mkdir -p $(RENDERTMP)
165
166 @echo "Adjusting for revision $(REV)..."
167 $(Q)xsltproc --nonet \
168 --xinclude \
169 --output $(RENDERTMP)/$(BLFSHTML2) \
170 --stringparam profile.revision $(REV) \
171 stylesheets/lfs-xsl/profile.xsl \
172 index.xml
173
174 @echo "Validating the book..."
175 $(Q)xmllint --nonet \
176 --noent \
177 --postvalid \
178 --output $(RENDERTMP)/$(BLFSFULL) \
179 $(RENDERTMP)/$(BLFSHTML2)
180
181profile-html: $(RENDERTMP)/$(BLFSHTML)
182$(RENDERTMP)/$(BLFSHTML): $(RENDERTMP)/$(BLFSFULL)
183 @echo "Generating profiled XML for XHTML..."
184 $(Q)xsltproc --nonet \
185 --stringparam profile.condition html \
186 --output $(RENDERTMP)/$(BLFSHTML) \
187 stylesheets/lfs-xsl/profile.xsl \
188 $(RENDERTMP)/$(BLFSFULL)
189
190blfs-patch-list: blfs-patches.sh
191 @echo "Generating blfs patch list..."
192 $(Q)awk '{if ($$1 == "copy") {sub(/.*\//, "", $$2); print $$2}}' \
193 blfs-patches.sh > blfs-patch-list
194
195blfs-patches.sh: $(RENDERTMP)/$(BLFSFULL)
196 @echo "Generating blfs patch script..."
197 $(Q)xsltproc --nonet \
198 --output blfs-patches.sh \
199 stylesheets/patcheslist.xsl \
200 $(RENDERTMP)/$(BLFSFULL)
201
202wget-list: $(BASEDIR)/wget-list
203$(BASEDIR)/wget-list: $(RENDERTMP)/$(BLFSFULL)
204 @echo "Generating wget list for $(REV) at $(BASEDIR)/wget-list ..."
205 $(Q)mkdir -p $(BASEDIR)
206 $(Q)xsltproc --nonet \
207 --output $(BASEDIR)/wget-list \
208 stylesheets/wget-list.xsl \
209 $(RENDERTMP)/$(BLFSFULL)
210
211test-links: $(BASEDIR)/test-links
212$(BASEDIR)/test-links: $(RENDERTMP)/$(BLFSFULL)
213 @echo "Generating test-links file..."
214 $(Q)mkdir -p $(BASEDIR)
215 $(Q)xsltproc --nonet \
216 --stringparam list_mode full \
217 --output $(BASEDIR)/test-links \
218 stylesheets/wget-list.xsl \
219 $(RENDERTMP)/$(BLFSFULL)
220
221 @echo "Checking URLs, first pass..."
222 $(Q)rm -f $(BASEDIR)/{good,bad,true_bad}_urls
223 $(Q)for URL in `cat $(BASEDIR)/test-links`; do \
224 wget --spider --tries=2 --timeout=60 $$URL >>/dev/null 2>&1; \
225 if test $$? -ne 0 ; then \
226 echo $$URL >> $(BASEDIR)/bad_urls ; \
227 else \
228 echo $$URL >> $(BASEDIR)/good_urls 2>&1; \
229 fi; \
230 done
231
232 @echo "Checking URLs, second pass..."
233 $(Q)for URL2 in `cat $(BASEDIR)/bad_urls`; do \
234 wget --spider --tries=2 --timeout=60 $$URL2 >>/dev/null 2>&1; \
235 if test $$? -ne 0 ; then \
236 echo $$URL2 >> $(BASEDIR)/true_bad_urls ; \
237 else \
238 echo $$URL2 >> $(BASEDIR)/good_urls 2>&1; \
239 fi; \
240 done
241
242bootscripts:
243 @VERSION=`grep "bootscripts-version " general.ent | cut -d\" -f2`; \
244 BOOTSCRIPTS="blfs-bootscripts-$$VERSION"; \
245 if [ ! -e $$BOOTSCRIPTS.tar.xz ]; then \
246 rm -rf $(RENDERTMP)/$$BOOTSCRIPTS; \
247 mkdir $(RENDERTMP)/$$BOOTSCRIPTS; \
248 cp -a ../bootscripts/* $(RENDERTMP)/$$BOOTSCRIPTS; \
249 rm -rf ../bootscripts/archive; \
250 tar -cJhf $$BOOTSCRIPTS.tar.xz -C $(RENDERTMP) $$BOOTSCRIPTS; \
251 fi
252
253systemd-units:
254 @VERSION=`grep "systemd-units-version " general.ent | cut -d\" -f2`; \
255 UNITS="blfs-systemd-units-$$VERSION"; \
256 if [ ! -e $$UNITS.tar.xz ]; then \
257 rm -rf $(RENDERTMP)/$$UNITS; \
258 mkdir $(RENDERTMP)/$$UNITS; \
259 cp -a ../systemd-units/* $(RENDERTMP)/$$UNITS; \
260 tar -cJhf $$UNITS.tar.xz -C $(RENDERTMP) $$UNITS; \
261 fi
262
263dump-commands: $(DUMPDIR)
264$(DUMPDIR): $(RENDERTMP)/$(BLFSFULL)
265 @echo "Dumping book commands..."
266 $(Q)xsltproc --output $(DUMPDIR)/ \
267 stylesheets/dump-commands.xsl \
268 $(RENDERTMP)/$(BLFSFULL)
269 $(Q)touch $(DUMPDIR)
270
271.PHONY: blfs all world html nochunks tmpdir clean \
272 validate profile-html blfs-patch-list wget-list \
273 test-links dump-commands bootscripts systemd-units
274
275version.ent: general.ent packages.ent $(ALLXML) $(ALLXSL)
276 $(Q)./git-version.sh $(REV)
277
278ALL_PYTHON_DEPS := $(filter-out $(PYHOSTED), \
279 $(wildcard general/prog/python-dependencies/*.xml))
280
281PYTHONHOSTED_MODS := requests sphinx_rtd_theme pytest gi-docgen
282
283PYTHONHOSTED_MOD_PAGES := $(addprefix general/prog/python-modules/,\
284 $(addsuffix .xml,$(PYTHONHOSTED_MODS)))
285
286$(PYHOSTED): $(ALL_PYTHON_DEPS) \
287 $(PYTHONHOSTED_MOD_PAGES) \
288 stylesheets/pyhosted-inc.xsl \
289 stylesheets/pythonhosted.xsl | version.ent
290 @echo Generating pythonhosted.xml; \
291 if [ ! -f $@ ]; then \
292 cp dummy.xml $(PYHOSTED); \
293 fi
294 $(Q)xsltproc --xinclude \
295 --output temp.xml \
296 --stringparam packages "$(PYTHONHOSTED_MODS)" \
297 stylesheets/pythonhosted.xsl \
298 general/prog/python-modules.xml
299 $(Q)mv temp.xml $@
Note: See TracBrowser for help on using the repository browser.