source: Makefile@ acb648f

11.1 11.2 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 upgradedb xry111/intltool xry111/llvm18 xry111/soup3 xry111/test-20220226 xry111/xf86-video-removal
Last change on this file since acb648f was 50836740, checked in by Xi Ruoyao <xry111@…>, 3 years ago

merge conditional XML from LFS

There was some consistency issues in URLs to LFS. For example, in
systemd revision the URL to LFS "General Network Configuration" points
to the sysv book, this can be really troubling to new readers.

Instead of fixing them one by one, merge conditional XML developed by
Pierre from LFS.

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