source: Makefile@ 0d80918a

12.1 12.1-rc1 multilib trunk xry111/arm64 xry111/clfs-ng xry111/loongarch xry111/loongarch-12.1 xry111/mips64el xry111/update-glibc
Last change on this file since 0d80918a was 0d80918a, checked in by Pierre Labastie <pierre.labastie@…>, 4 months ago

Makefile: change ~ to $(HOME)

This is more readable.
Also remove obsolete variables at start.

Part of a patch by Boian Berberov

  • Property mode set to 100644
File size: 7.4 KB
Line 
1# vim:ts=3
2RENDERTMP = $(HOME)/tmp
3CHUNK_QUIET = 1
4ROOT_ID =
5SHELL = /bin/bash
6
7ifdef V
8 Q =
9else
10 Q = @
11endif
12
13ifndef REV
14 REV = sysv
15endif
16
17ifneq ($(REV), sysv)
18 ifneq ($(REV), systemd)
19 $(error REV must be 'sysv' (default) or 'systemd'.)
20 endif
21endif
22
23ifeq ($(REV), sysv)
24 BASEDIR ?= $(HOME)/public_html/lfs-book
25 PDF_OUTPUT ?= LFS-BOOK.pdf
26 NOCHUNKS_OUTPUT ?= LFS-BOOK.html
27 DUMPDIR ?= $(HOME)/lfs-commands
28else
29 BASEDIR ?= $(HOME)/public_html/lfs-systemd
30 PDF_OUTPUT ?= LFS-SYSD-BOOK.pdf
31 NOCHUNKS_OUTPUT ?= LFS-SYSD-BOOK.html
32 DUMPDIR ?= $(HOME)/lfs-sysd-commands
33endif
34
35book: validate profile-html
36 @echo "Generating chunked XHTML files at $(BASEDIR)/ ..."
37 $(Q)xsltproc --nonet \
38 --stringparam chunk.quietly $(CHUNK_QUIET) \
39 --stringparam rootid "$(ROOT_ID)" \
40 --stringparam base.dir $(BASEDIR)/ \
41 stylesheets/lfs-chunked.xsl \
42 $(RENDERTMP)/lfs-html.xml
43
44 @echo "Copying CSS code and images..."
45 $(Q)mkdir -p $(BASEDIR)/stylesheets
46 $(Q)cp stylesheets/lfs-xsl/*.css $(BASEDIR)/stylesheets
47 $(Q)sed -i 's|../stylesheet|stylesheet|' $(BASEDIR)/index.html
48
49 $(Q)mkdir -p $(BASEDIR)/images
50 $(Q)cp images/*.png $(BASEDIR)/images
51
52 @echo "Running Tidy and obfuscate.sh..."
53 $(Q)for filename in `find $(BASEDIR) -name "*.html"`; do \
54 tidy -config tidy.conf $$filename; \
55 true; \
56 /bin/bash obfuscate.sh $$filename; \
57 sed -e "s@text/html@application/xhtml+xml@g" \
58 -i $$filename; \
59 done;
60
61 $(Q)$(MAKE) --no-print-directory wget-list md5sums
62
63pdf: validate
64 @echo "Generating profiled XML for PDF..."
65 $(Q)xsltproc --nonet \
66 --stringparam profile.condition pdf \
67 --output $(RENDERTMP)/lfs-pdf.xml \
68 stylesheets/lfs-xsl/profile.xsl \
69 $(RENDERTMP)/lfs-full.xml
70
71 @echo "Generating FO file..."
72 $(Q)xsltproc --nonet \
73 --stringparam rootid "$(ROOT_ID)" \
74 --output $(RENDERTMP)/lfs-pdf.fo \
75 stylesheets/lfs-pdf.xsl \
76 $(RENDERTMP)/lfs-pdf.xml
77
78 $(Q)sed -i -e 's/span="inherit"/span="all"/' $(RENDERTMP)/lfs-pdf.fo
79 $(Q)bash pdf-fixups.sh $(RENDERTMP)/lfs-pdf.fo
80
81 @echo "Generating PDF file..."
82 $(Q)mkdir -p $(RENDERTMP)/images
83 $(Q)cp images/*.png $(RENDERTMP)/images
84
85 $(Q)mkdir -p $(BASEDIR)
86
87 $(Q)fop -q $(RENDERTMP)/lfs-pdf.fo $(BASEDIR)/$(PDF_OUTPUT) 2>fop.log
88 @echo "$(BASEDIR)/$(PDF_OUTPUT) created"
89 @echo "fop.log created"
90
91nochunks: validate profile-html
92 @echo "Generating non chunked XHTML file..."
93 $(Q)xsltproc --nonet \
94 --stringparam rootid "$(ROOT_ID)" \
95 --output $(BASEDIR)/$(NOCHUNKS_OUTPUT) \
96 stylesheets/lfs-nochunks.xsl \
97 $(RENDERTMP)/lfs-html.xml
98# $(RENDERTMP)/lfs-html2.xml
99
100 @echo "Running Tidy..."
101 $(Q)tidy -config tidy.conf $(BASEDIR)/$(NOCHUNKS_OUTPUT) || true
102
103 @echo "Running obfuscate.sh..."
104 $(Q)bash obfuscate.sh $(BASEDIR)/$(NOCHUNKS_OUTPUT)
105 $(Q)sed -i -e "s@text/html@application/xhtml+xml@g" $(BASEDIR)/$(NOCHUNKS_OUTPUT)
106 $(Q)sed -i -e "s@../wget-list@wget-list@" $(BASEDIR)/$(NOCHUNKS_OUTPUT)
107 $(Q)sed -i -e "s@../md5sums@md5sums@" $(BASEDIR)/$(NOCHUNKS_OUTPUT)
108
109 @echo "Output at $(BASEDIR)/$(NOCHUNKS_OUTPUT)"
110
111tmpdir:
112 @echo "Creating and cleaning $(RENDERTMP)"
113 $(Q)mkdir -p $(RENDERTMP)
114 $(Q)rm -f $(RENDERTMP)/lfs*.xml
115 $(Q)rm -f $(RENDERTMP)/*wget*
116 $(Q)rm -f $(RENDERTMP)/*md5sum*
117 $(Q)rm -f $(RENDERTMP)/*pdf.fo
118
119validate: tmpdir version
120 @echo "Processing bootscripts..."
121 $(Q)bash process-scripts.sh
122
123 @echo "Adjusting for revision $(REV)..."
124 $(Q)xsltproc --nonet \
125 --xinclude \
126 --output $(RENDERTMP)/lfs-html2.xml \
127 --stringparam profile.revision $(REV) \
128 stylesheets/lfs-xsl/profile.xsl \
129 index.xml
130
131 @echo "Validating the book..."
132 $(Q)xmllint --nonet \
133 --noent \
134 --postvalid \
135 -o $(RENDERTMP)/lfs-full.xml \
136 $(RENDERTMP)/lfs-html2.xml
137
138 $(Q)rm -f appendices/*.script
139 $(Q)./aux-file-data.sh $(RENDERTMP)/lfs-full.xml
140 @echo "Validation complete."
141
142profile-html:
143 @echo "Generating profiled XML for XHTML..."
144 $(Q)xsltproc --nonet \
145 --stringparam profile.condition html \
146 --output $(RENDERTMP)/lfs-html.xml \
147 stylesheets/lfs-xsl/profile.xsl \
148 $(RENDERTMP)/lfs-full.xml
149
150DOWNLOADS_DEP = chapter03/packages.xml chapter03/patches.xml \
151 packages.ent patches.ent general.ent
152
153wget-list: $(BASEDIR)/wget-list $(BASEDIR)/wget-list-$(REV)
154$(BASEDIR)/wget-list: stylesheets/wget-list.xsl $(DOWNLOADS_DEP)
155 @echo "Generating consolidated wget list at $(BASEDIR)/wget-list ..."
156 $(Q)mkdir -p $(BASEDIR)
157 $(Q)xsltproc --xinclude --nonet \
158 --output $(BASEDIR)/wget-list \
159 stylesheets/wget-list.xsl \
160 chapter03/chapter03.xml
161
162$(BASEDIR)/wget-list-$(REV): stylesheets/wget-list.xsl $(DOWNLOADS_DEP)
163 $(Q)xsltproc --nonet --xinclude \
164 --stringparam profile.revision $(REV) \
165 --output $(RENDERTMP)/wget-list.xml \
166 stylesheets/lfs-xsl/profile.xsl \
167 chapter03/chapter03.xml
168 $(Q)xsltproc --xinclude --nonet \
169 --output $(BASEDIR)/wget-list-$(REV) \
170 stylesheets/wget-list.xsl \
171 $(RENDERTMP)/wget-list.xml
172
173md5sums: $(BASEDIR)/md5sums
174$(BASEDIR)/md5sums: stylesheets/wget-list.xsl $(DOWNLOADS_DEP)
175 @echo "Generating consolidated md5sum file at $(BASEDIR)/md5sums ..."
176 $(Q)mkdir -p $(BASEDIR)
177
178 $(Q)xsltproc --nonet --xinclude \
179 --stringparam profile.revision $(REV) \
180 --output $(RENDERTMP)/md5sum.xml \
181 stylesheets/lfs-xsl/profile.xsl \
182 chapter03/chapter03.xml
183
184 $(Q)xsltproc --xinclude --nonet \
185 --output $(BASEDIR)/md5sums \
186 stylesheets/md5sum.xsl \
187 $(RENDERTMP)/md5sum.xml
188 $(Q)sed -i -e \
189 "s/BOOTSCRIPTS-MD5SUM/$(shell md5sum lfs-bootscripts*.tar.xz | cut -d' ' -f1)/" \
190 $(BASEDIR)/md5sums
191
192version:
193 $(Q)./git-version.sh $(REV)
194
195dump-commands: validate
196 @echo "Dumping book commands..."
197
198 $(Q)rm -rf $(DUMPDIR)
199
200 $(Q)xsltproc --output $(DUMPDIR)/ \
201 stylesheets/dump-commands.xsl \
202 $(RENDERTMP)/lfs-full.xml
203 @echo "Dumping book commands complete in $(DUMPDIR)"
204
205all: book nochunks pdf dump-commands
206
207dist:
208 $(Q)DIST=/tmp/LFS-RELEASE ./git-version.sh $(REV)
209 $(Q)rm -f lfs-$$(</tmp/LFS-RELEASE).tar.xz
210 $(Q)tar cJf lfs-$$(</tmp/LFS-RELEASE).tar.xz \
211 $(shell git ls-tree HEAD . --name-only) version.ent \
212 -C /tmp LFS-RELEASE \
213 --transform "s,^,lfs-$$(</tmp/LFS-RELEASE)/,"
214 $(Q)echo "Generated XML tarball lfs-$$(</tmp/LFS-RELEASE).tar.xz"
215
216.PHONY : all book dump-commands nochunks pdf profile-html tmpdir validate md5sums wget-list version dist
217
Note: See TracBrowser for help on using the repository browser.