source: Makefile@ b8194e0

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 b8194e0 was b8194e0, checked in by Pierre Labastie <pierre.labastie@…>, 5 months ago

make default BASEDIR in public_html

that is:

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