source: Makefile@ 0945dd2d

12.0 12.1 kea ken/TL2024 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 0945dd2d was e3047fd, checked in by Pierre Labastie <pierre.labastie@…>, 15 months ago

Restore the render system to what it was before pythonhosted changes

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