source: Makefile@ b264d67

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 b264d67 was 036d893e, checked in by Xi Ruoyao <xry111@…>, 16 months ago

build: make version.ent a .PHONY

Because we don't know how to track its dependencies... The content
actually depends on some Git metadata.

  • Property mode set to 100644
File size: 11.5 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)))
16#ALLXSL := $(filter-out $(RENDERTMP)/%, \
17# $(wildcard *.xsl */*.xsl */*/*.xsl */*/*/*.xsl */*/*/*/*.xsl))
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$(RENDERTMP)/$(BLFSFULL): 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
275.PHONY: version.ent
276version.ent: general.ent packages.ent $(ALLXML) $(ALLXSL)
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 $@
Note: See TracBrowser for help on using the repository browser.