source: Makefile@ 17c9da8

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

generate version info from git

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