source: Makefile@ 51bec49

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 51bec49 was 51bec49, checked in by Pierre Labastie <pierre.labastie@…>, 17 months ago

Makefile: don't always make version.ent

If nothing has changed in the book, there is no need to regenerate
version.ent, blfs-full.xml, etc... So only make version.ent
.PHONY if REV has changed.

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