source: Makefile@ 69d280f

ml-11.0 multilib xry111/multilib
Last change on this file since 69d280f was 69d280f, checked in by Thomas Trepl (Moody) <thomas@…>, 3 years ago

Automatic merge of trunk into multilib

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