source: Makefile@ d7d7e0e5

11.0 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 d7d7e0e5 was ccded7e, checked in by Xi Ruoyao <xry111@…>, 3 years ago

clean up unused SVN prop entries

  • Property mode set to 100644
File size: 8.3 KB
Line 
1# Makefile for BLFS Book generation.
2# By Tushar Teredesai <tushar@linuxfromscratch.org>
3# 2004-01-31
4
5# Adjust these to suit your installation
6RENDERTMP ?= $(HOME)/tmp
7CHUNK_QUIET = 1
8ROOT_ID =
9SHELL = /bin/bash
10
11ALLXML := $(filter-out $(RENDERTMP)/%, \
12 $(wildcard *.xml */*.xml */*/*.xml */*/*/*.xml */*/*/*/*.xml))
13ALLXSL := $(filter-out $(RENDERTMP)/%, \
14 $(wildcard *.xsl */*.xsl */*/*.xsl */*/*/*.xsl */*/*/*/*.xsl))
15
16ifdef V
17 Q =
18else
19 Q = @
20endif
21
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
36 BLFSHTML ?= blfs-html.xml
37 BLFSHTML2 ?= blfs-html2.xml
38 BLFSFULL ?= blfs-full.xml
39else
40 BASEDIR ?= $(HOME)/public_html/blfs-systemd
41 NOCHUNKS_OUTPUT ?= blfs-sysd-book.html
42 DUMPDIR ?= ~/blfs-sysd-commands
43 BLFSHTML ?= blfs-systemd-html.xml
44 BLFSHTML2 ?= blfs-systemd-html2.xml
45 BLFSFULL ?= blfs-systemd-full.xml
46
47endif
48
49
50blfs: html wget-list
51
52all: blfs nochunks
53world: all blfs-patch-list dump-commands test-links
54
55html: $(BASEDIR)/index.html
56$(BASEDIR)/index.html: $(RENDERTMP)/$(BLFSHTML) version
57 @echo "Generating chunked XHTML files..."
58 $(Q)xsltproc --nonet \
59 --stringparam chunk.quietly $(CHUNK_QUIET) \
60 --stringparam rootid "$(ROOT_ID)" \
61 --stringparam base.dir $(BASEDIR)/ \
62 stylesheets/blfs-chunked.xsl \
63 $(RENDERTMP)/$(BLFSHTML)
64
65 @echo "Copying CSS code and images..."
66 $(Q)if [ ! -e $(BASEDIR)/stylesheets ]; then \
67 mkdir -p $(BASEDIR)/stylesheets; \
68 fi;
69
70 $(Q)cp stylesheets/lfs-xsl/*.css $(BASEDIR)/stylesheets
71
72 $(Q)if [ ! -e $(BASEDIR)/images ]; then \
73 mkdir -p $(BASEDIR)/images; \
74 fi;
75 $(Q)cp images/*.png $(BASEDIR)/images
76
77 $(Q)cd $(BASEDIR)/; sed -e "s@../images@images@g" \
78 -i *.html
79
80 @echo "Running Tidy and obfuscate.sh on chunked XHTML..."
81 $(Q)for filename in `find $(BASEDIR) -name "*.html"`; do \
82 tidy -config tidy.conf $$filename; \
83 true; \
84 bash obfuscate.sh $$filename; \
85 sed -i -e "s@text/html@application/xhtml+xml@g" $$filename; \
86 done;
87
88nochunks: $(BASEDIR)/$(NOCHUNKS_OUTPUT)
89$(BASEDIR)/$(NOCHUNKS_OUTPUT): $(RENDERTMP)/$(BLFSHTML) version
90 @echo "Generating non-chunked XHTML file..."
91 $(Q)xsltproc --nonet \
92 --stringparam rootid "$(ROOT_ID)" \
93 --output $(BASEDIR)/$(NOCHUNKS_OUTPUT) \
94 stylesheets/blfs-nochunks.xsl \
95 $(RENDERTMP)/$(BLFSHTML)
96
97 @echo "Running Tidy and obfuscate.sh on non-chunked XHTML..."
98 $(Q)tidy -config tidy.conf $(BASEDIR)/$(NOCHUNKS_OUTPUT) || true
99 $(Q)bash obfuscate.sh $(BASEDIR)/$(NOCHUNKS_OUTPUT)
100 $(Q)sed -i -e "s@text/html@application/xhtml+xml@g" $(BASEDIR)/$(NOCHUNKS_OUTPUT)
101
102tmpdir: $(RENDERTMP)
103$(RENDERTMP):
104 @echo "Creating $(RENDERTMP)"
105 $(Q)[ -d $(RENDERTMP) ] || mkdir -p $(RENDERTMP)
106
107clean:
108 @echo "Cleaning $(RENDERTMP)"
109 $(Q)rm -f $(RENDERTMP)/blfs*
110
111validate: $(RENDERTMP)/$(BLFSFULL)
112$(RENDERTMP)/$(BLFSFULL): general.ent packages.ent $(ALLXML) $(ALLXSL) version
113 $(Q)[ -d $(RENDERTMP) ] || mkdir -p $(RENDERTMP)
114
115 @echo "Adjusting for revision $(REV)..."
116 $(Q)xsltproc --nonet \
117 --xinclude \
118 --output $(RENDERTMP)/$(BLFSHTML2) \
119 --stringparam profile.revision $(REV) \
120 stylesheets/lfs-xsl/profile.xsl \
121 index.xml
122
123 @echo "Validating the book..."
124 $(Q)xmllint --nonet \
125 --noent \
126 --postvalid \
127 --output $(RENDERTMP)/$(BLFSFULL) \
128 $(RENDERTMP)/$(BLFSHTML2)
129
130profile-html: $(RENDERTMP)/$(BLFSHTML)
131$(RENDERTMP)/$(BLFSHTML): $(RENDERTMP)/$(BLFSFULL) version
132 @echo "Generating profiled XML for XHTML..."
133 $(Q)xsltproc --nonet \
134 --stringparam profile.condition html \
135 --output $(RENDERTMP)/$(BLFSHTML) \
136 stylesheets/lfs-xsl/profile.xsl \
137 $(RENDERTMP)/$(BLFSFULL)
138
139blfs-patch-list: blfs-patches.sh
140 @echo "Generating blfs patch list..."
141 $(Q)awk '{if ($$1 == "copy") {sub(/.*\//, "", $$2); print $$2}}' \
142 blfs-patches.sh > blfs-patch-list
143
144blfs-patches.sh: $(RENDERTMP)/$(BLFSFULL) version
145 @echo "Generating blfs patch script..."
146 $(Q)xsltproc --nonet \
147 --output blfs-patches.sh \
148 stylesheets/patcheslist.xsl \
149 $(RENDERTMP)/$(BLFSFULL)
150
151wget-list: $(BASEDIR)/wget-list
152$(BASEDIR)/wget-list: $(RENDERTMP)/$(BLFSFULL) version
153 @echo "Generating wget list for $(REV) at $(BASEDIR)/wget-list ..."
154 $(Q)mkdir -p $(BASEDIR)
155 $(Q)xsltproc --nonet \
156 --output $(BASEDIR)/wget-list \
157 stylesheets/wget-list.xsl \
158 $(RENDERTMP)/$(BLFSFULL)
159
160test-links: $(BASEDIR)/test-links
161$(BASEDIR)/test-links: $(RENDERTMP)/$(BLFSFULL) version
162 @echo "Generating test-links file..."
163 $(Q)mkdir -p $(BASEDIR)
164 $(Q)xsltproc --nonet \
165 --stringparam list_mode full \
166 --output $(BASEDIR)/test-links \
167 stylesheets/wget-list.xsl \
168 $(RENDERTMP)/$(BLFSFULL)
169
170 @echo "Checking URLs, first pass..."
171 $(Q)rm -f $(BASEDIR)/{good,bad,true_bad}_urls
172 $(Q)for URL in `cat $(BASEDIR)/test-links`; do \
173 wget --spider --tries=2 --timeout=60 $$URL >>/dev/null 2>&1; \
174 if test $$? -ne 0 ; then \
175 echo $$URL >> $(BASEDIR)/bad_urls ; \
176 else \
177 echo $$URL >> $(BASEDIR)/good_urls 2>&1; \
178 fi; \
179 done
180
181 @echo "Checking URLs, second pass..."
182 $(Q)for URL2 in `cat $(BASEDIR)/bad_urls`; do \
183 wget --spider --tries=2 --timeout=60 $$URL2 >>/dev/null 2>&1; \
184 if test $$? -ne 0 ; then \
185 echo $$URL2 >> $(BASEDIR)/true_bad_urls ; \
186 else \
187 echo $$URL2 >> $(BASEDIR)/good_urls 2>&1; \
188 fi; \
189 done
190
191bootscripts:
192 @VERSION=`grep "bootscripts-version " general.ent | cut -d\" -f2`; \
193 BOOTSCRIPTS="blfs-bootscripts-$$VERSION"; \
194 if [ ! -e $$BOOTSCRIPTS.tar.xz ]; then \
195 rm -rf $(RENDERTMP)/$$BOOTSCRIPTS; \
196 mkdir $(RENDERTMP)/$$BOOTSCRIPTS; \
197 cp -a ../bootscripts/* $(RENDERTMP)/$$BOOTSCRIPTS; \
198 rm -rf ../bootscripts/archive; \
199 tar -cJhf $$BOOTSCRIPTS.tar.xz -C $(RENDERTMP) $$BOOTSCRIPTS; \
200 fi
201
202systemd-units:
203 @VERSION=`grep "systemd-units-version " general.ent | cut -d\" -f2`; \
204 UNITS="blfs-systemd-units-$$VERSION"; \
205 if [ ! -e $$UNITS.tar.xz ]; then \
206 rm -rf $(RENDERTMP)/$$UNITS; \
207 mkdir $(RENDERTMP)/$$UNITS; \
208 cp -a ../systemd-units/* $(RENDERTMP)/$$UNITS; \
209 tar -cJhf $$UNITS.tar.xz -C $(RENDERTMP) $$UNITS; \
210 fi
211
212dump-commands: $(DUMPDIR)
213$(DUMPDIR): $(RENDERTMP)/$(BLFSFULL) version
214 @echo "Dumping book commands..."
215 $(Q)xsltproc --output $(DUMPDIR)/ \
216 stylesheets/dump-commands.xsl \
217 $(RENDERTMP)/$(BLFSFULL)
218 $(Q)touch $(DUMPDIR)
219
220.PHONY: blfs all world html nochunks tmpdir clean \
221 validate profile-html blfs-patch-list wget-list test-links \
222 dump-commands bootscripts systemd-units version
223
224version:
225 $(Q)./git-version.sh
Note: See TracBrowser for help on using the repository browser.