1 | TOP := $(shell pwd)
|
---|
2 | RENDERDIR := $(TOP)/../render
|
---|
3 |
|
---|
4 | VALIDATEDIR := $(RENDERDIR)/validate
|
---|
5 | DBXMLDIR := $(RENDERDIR)/docbook
|
---|
6 | PROFILEDIR := $(RENDERDIR)/profile
|
---|
7 |
|
---|
8 | HTMLDIR := $(RENDERDIR)/html
|
---|
9 | NOCHUNKDIR := $(RENDERDIR)/nochunk
|
---|
10 |
|
---|
11 | FODIR := $(RENDERDIR)/fo
|
---|
12 | PDFDIR := $(RENDERDIR)/pdf
|
---|
13 |
|
---|
14 | TROUBLEDIR := $(RENDERDIR)/trouble
|
---|
15 | DUMPDIR := $(RENDERDIR)/commands
|
---|
16 | DLLISTDIR := $(RENDERDIR)/download-list
|
---|
17 |
|
---|
18 | CHUNK_QUIET := 1
|
---|
19 | ROOT_ID :=
|
---|
20 |
|
---|
21 | ARCHS := x86 x86_64 x86_64-64 \
|
---|
22 | sparc sparc64 sparc64-64 \
|
---|
23 | mips mips64 mips64-64 \
|
---|
24 | ppc ppc64 ppc64-64
|
---|
25 | # alpha Not tested anymore
|
---|
26 |
|
---|
27 | x86_ML := 32
|
---|
28 | x86_64_ML := 32,64
|
---|
29 | x86_64-64_ML := 64
|
---|
30 | sparc_ML := 32
|
---|
31 | sparc64_ML := 32,64
|
---|
32 | sparc64-64_ML := 64
|
---|
33 | mips_ML := 32
|
---|
34 | mips64_ML := 32,n32,64
|
---|
35 | mips64-64_ML := 64
|
---|
36 | ppc_ML := 32
|
---|
37 | ppc64_ML := 32,64
|
---|
38 | alpha_ML := 64
|
---|
39 |
|
---|
40 | ifdef V
|
---|
41 | Q =
|
---|
42 | else
|
---|
43 | Q = @
|
---|
44 | endif
|
---|
45 |
|
---|
46 | .PHONY: clfs lfs
|
---|
47 | clfs lfs: html
|
---|
48 |
|
---|
49 | .PHONY: tidy tidy-f tidy-d
|
---|
50 | ifeq ($(shell which tidy >/dev/null 2>&1 && echo yes),yes)
|
---|
51 | tidy:
|
---|
52 | @$(MAKE) --no-print-directory tidy-d TIDY_DIR=$(HTMLDIR)
|
---|
53 |
|
---|
54 | tidy-f:
|
---|
55 | @echo "Running tidy on F:$(shell basename $(TIDY_FILE))"
|
---|
56 | @$(TOP)/tidy.sh "$(TIDY_FILE)"
|
---|
57 |
|
---|
58 | tidy-d:
|
---|
59 | @echo "Running tidy on D:$(shell basename $(TIDY_DIR))"
|
---|
60 | @$(TOP)/tidy.sh "$(TIDY_DIR)"
|
---|
61 | else
|
---|
62 | tidy tidy-f tidy-d:
|
---|
63 | @echo "Tidy is not installed on this system"
|
---|
64 | endif
|
---|
65 |
|
---|
66 | .PHONY: titlepage
|
---|
67 | titlepage:
|
---|
68 | @echo "Rendering the top-level index..."
|
---|
69 | $(Q)xsltproc --nonet --output $(HTMLDIR)/index.html \
|
---|
70 | $(TOP)/stylesheets/top-index.xsl \
|
---|
71 | $(TOP)/index.xml
|
---|
72 | @$(MAKE) --no-print-directory tidy-f TIDY_FILE=$(HTMLDIR)/index.html
|
---|
73 |
|
---|
74 | ARCHS_VD_XML := $(ARCHS:%=%-validate_dump-xml)
|
---|
75 | .PHONY: $(ARCHS_VD_XML)
|
---|
76 | $(ARCHS_VD_XML): override arch = $(@:%-validate_dump-xml=%)
|
---|
77 | $(ARCHS_VD_XML):
|
---|
78 | @echo "Validating $(arch) against the CLFS Schema..."
|
---|
79 | $(Q)mkdir -p $(VALIDATEDIR)
|
---|
80 | $(Q)xmllint --nonet --noent --xinclude \
|
---|
81 | --relaxng $(TOP)/schema/clfs/0.1/rng/clfs.rng \
|
---|
82 | -o $(VALIDATEDIR)/$(arch)-full.xml \
|
---|
83 | $(TOP)/$(arch)-index.xml \
|
---|
84 | 2>&1 | grep -v " validates$$"; \
|
---|
85 | if test $${?} -ne 0; then true; else false; fi
|
---|
86 |
|
---|
87 | ARCHS_DB_XML := $(ARCHS:%=%-db-xml)
|
---|
88 | .PHONY: $(ARCHS_DB_XML)
|
---|
89 | $(ARCHS_DB_XML): override arch = $(@:%-db-xml=%)
|
---|
90 | $(ARCHS_DB_XML):
|
---|
91 | @$(MAKE) --no-print-directory $(arch)-validate_dump-xml
|
---|
92 | @echo "Generating DocBook XML for $(arch)..."
|
---|
93 | $(Q)mkdir -p $(DBXMLDIR)
|
---|
94 | $(Q)xsltproc --nonet \
|
---|
95 | --stringparam clfs.arch "$(arch)" \
|
---|
96 | --stringparam clfs.multilib "$($(arch)_ML)" \
|
---|
97 | --output $(DBXMLDIR)/$(arch)-db.xml \
|
---|
98 | $(TOP)/stylesheets/clfs-profile.xsl \
|
---|
99 | $(VALIDATEDIR)/$(arch)-full.xml
|
---|
100 |
|
---|
101 | ARCHS_P_XML := $(ARCHS:%=%-profiled-xml)
|
---|
102 | .PHONY: $(ARCHS_P_XML)
|
---|
103 | $(ARCHS_P_XML): override arch = $(@:%-profiled-xml=%)
|
---|
104 | $(ARCHS_P_XML):
|
---|
105 | @$(MAKE) --no-print-directory $(arch)-db-xml
|
---|
106 | @echo "Profiling $(arch) for rendering..."
|
---|
107 | $(Q)mkdir -p $(PROFILEDIR)
|
---|
108 | $(Q)xsltproc --nonet \
|
---|
109 | --stringparam profile.condition html \
|
---|
110 | --output $(PROFILEDIR)/$(arch)-html.xml \
|
---|
111 | $(TOP)/stylesheets/lfs-xsl/profile.xsl \
|
---|
112 | $(DBXMLDIR)/$(arch)-db.xml
|
---|
113 |
|
---|
114 | ARCHS_VDB_XML := $(ARCHS:%=%-validate_db-xml)
|
---|
115 | .PHONY: $(ARCHS_VDB_XML)
|
---|
116 | $(ARCHS_VDB_XML): override arch = $(@:%-validate_db-xml=%)
|
---|
117 | $(ARCHS_VDB_XML):
|
---|
118 | @echo "Validating $(arch) against the DocBook Schema..."
|
---|
119 | $(Q)xmllint --noout --nonet \
|
---|
120 | --relaxng $(TOP)/schema/docbook/4.5/rng/docbook.rng \
|
---|
121 | $(PROFILEDIR)/$(arch)-html.xml \
|
---|
122 | 2>&1 | grep -v " validates$$"; \
|
---|
123 | if test $${?} -ne 0; then true; else false; fi
|
---|
124 |
|
---|
125 | ARCHS_HTML := $(ARCHS:%=%-html)
|
---|
126 | .PHONY: html render $(ARCHS_HTML)
|
---|
127 | html render: $(ARCHS_HTML) titlepage
|
---|
128 | $(ARCHS_HTML): override arch = $(@:%-html=%)
|
---|
129 | $(ARCHS_HTML):
|
---|
130 | @$(MAKE) --no-print-directory $(arch)-profiled-xml
|
---|
131 | @$(MAKE) --no-print-directory $(arch)-validate_db-xml
|
---|
132 |
|
---|
133 | @echo "Rendering chunked XHTML of $(arch)..."
|
---|
134 | $(Q)mkdir -p $(HTMLDIR)/$(arch)
|
---|
135 | $(Q)xsltproc --nonet -stringparam chunk.quietly $(CHUNK_QUIET) \
|
---|
136 | -stringparam rootid "$(ROOT_ID)" \
|
---|
137 | -stringparam base.dir $(HTMLDIR)/$(arch)/ \
|
---|
138 | $(TOP)/stylesheets/clfs-chunked.xsl \
|
---|
139 | $(PROFILEDIR)/$(arch)-html.xml
|
---|
140 |
|
---|
141 | @echo "Copying CSS code and images for $(arch)..."
|
---|
142 | $(Q)mkdir -p $(HTMLDIR)/$(arch)/stylesheets
|
---|
143 | $(Q)cp $(TOP)/stylesheets/lfs-xsl/*.css $(HTMLDIR)/$(arch)/stylesheets
|
---|
144 | $(Q)sed -i -e "s@../stylesheets@stylesheets@g" $(HTMLDIR)/$(arch)/*.html
|
---|
145 | $(Q)mkdir -p $(HTMLDIR)/$(arch)/images
|
---|
146 | $(Q)cp $(TOP)/images/*.png $(HTMLDIR)/$(arch)/images
|
---|
147 | $(Q)sed -i -e "s@../images@images@g" $(HTMLDIR)/$(arch)/*.html
|
---|
148 |
|
---|
149 | @$(MAKE) --no-print-directory tidy-d TIDY_DIR=$(HTMLDIR)/$(arch)
|
---|
150 |
|
---|
151 | ARCHS_NOCHUNKS := $(ARCHS:%=%-nochunks)
|
---|
152 | .PHONY: nochunks $(ARCHS_NOCHUNKS)
|
---|
153 | nochunks: $(ARCHS_NOCHUNKS)
|
---|
154 | $(ARCHS_NOCHUNKS): override arch = $(@:%-nochunks=%)
|
---|
155 | $(ARCHS_NOCHUNKS):
|
---|
156 | @$(MAKE) --no-print-directory $(arch)-profiled-xml
|
---|
157 | @$(MAKE) --no-print-directory $(arch)-validate_db-xml
|
---|
158 |
|
---|
159 | @echo "Rendering Single File HTML of $(arch)..."
|
---|
160 | $(Q)mkdir -p $(NOCHUNKDIR)
|
---|
161 | $(Q)xsltproc --nonet -stringparam rootid "$(ROOT_ID)" \
|
---|
162 | --output $(NOCHUNKDIR)/CLFS-$(arch).html \
|
---|
163 | $(TOP)/stylesheets/clfs-nochunks.xsl \
|
---|
164 | $(PROFILEDIR)/$(arch)-html.xml
|
---|
165 |
|
---|
166 | @$(MAKE) --no-print-directory tidy-f TIDY_FILE=$(NOCHUNKDIR)/CLFS-$(arch).html
|
---|
167 |
|
---|
168 | ARCHS_FO := $(ARCHS:%=%-fo)
|
---|
169 | .PHONY: fo $(ARCHS_FO)
|
---|
170 | fo: $(ARCHS_FO)
|
---|
171 | $(ARCHS_FO): override arch = $(@:%-fo=%)
|
---|
172 | $(ARCHS_FO):
|
---|
173 | @$(MAKE) --no-print-directory $(arch)-profiled-xml
|
---|
174 | @$(MAKE) --no-print-directory $(arch)-validate_db-xml
|
---|
175 |
|
---|
176 | @echo "Generating FO file of $(arch)..."
|
---|
177 | @mkdir -p $(FODIR)
|
---|
178 | $(Q)xsltproc --nonet -stringparam rootid "$(ROOT_ID)" \
|
---|
179 | --output $(FODIR)/$(arch).fo \
|
---|
180 | $(TOP)/stylesheets/clfs-pdf.xsl \
|
---|
181 | $(PROFILEDIR)/$(arch)-html.xml
|
---|
182 | $(Q)sed -i -e 's/span="inherit"/span="all"/' $(FODIR)/$(arch).fo
|
---|
183 |
|
---|
184 | ARCHS_PDF := $(ARCHS:%=%-pdf)
|
---|
185 | .PHONY: pdf $(ARCHS_PDF)
|
---|
186 | pdf: $(ARCHS_PDF)
|
---|
187 | $(ARCHS_PDF): override arch = $(@:%-pdf=%)
|
---|
188 | $(ARCHS_PDF):
|
---|
189 | @$(MAKE) --no-print-directory $(arch)-fo
|
---|
190 |
|
---|
191 | @echo "Rendering PDF of $(arch)..."
|
---|
192 | $(Q)mkdir -p $(PDFDIR)
|
---|
193 | $(Q)fop $(FODIR)/$(arch).fo $(PDFDIR)/CLFS-$(arch).pdf
|
---|
194 |
|
---|
195 | ARCHS_VALIDATE := $(ARCHS:%=%-validate)
|
---|
196 | .PHONY: validate $(ARCHS_VALIDATE)
|
---|
197 | validate: $(ARCHS_VALIDATE)
|
---|
198 | $(ARCHS_VALIDATE): override arch = $(@:%-validate=%)
|
---|
199 | $(ARCHS_VALIDATE):
|
---|
200 | @echo "Validating $(arch) against the CLFS Schema..."
|
---|
201 | $(Q)xmllint --xinclude --noout --nonet \
|
---|
202 | --relaxng $(TOP)/schema/clfs/0.1/rng/clfs.rng \
|
---|
203 | $(TOP)/$(arch)-index.xml \
|
---|
204 | 2>&1 | grep -v " validates$$"; \
|
---|
205 | if test $${?} -ne 0; then true; else false; fi
|
---|
206 |
|
---|
207 | ARCHS_TROUBLE := $(ARCHS:%=%-trouble)
|
---|
208 | .PHONY: trouble $(ARCHS_TROUBLE)
|
---|
209 | trouble: $(ARCHS_TROUBLE)
|
---|
210 | $(ARCHS_TROUBLE): override arch = $(@:%-trouble=%)
|
---|
211 | $(ARCHS_TROUBLE):
|
---|
212 | @echo "Troubleshooting $(arch)..."
|
---|
213 | @mkdir -p $(TROUBLEDIR)
|
---|
214 | $(Q)xmllint --xinclude --nonet \
|
---|
215 | --relaxng $(TOP)/schema/clfs/0.1/rng/clfs.rng \
|
---|
216 | -o $(TROUBLEDIR)/dump-$(arch) \
|
---|
217 | $(TOP)/$(arch)-index.xml \
|
---|
218 | 2>&1 | grep -v " validates$$"; \
|
---|
219 | if test $${?} -ne 0; then true; else false; fi
|
---|
220 | $(Q)xmllint --xinclude --noout --nonet \
|
---|
221 | --relaxng $(TOP)/schema/clfs/0.1/rng/clfs.rng \
|
---|
222 | $(TROUBLEDIR)/dump-$(arch) \
|
---|
223 | 2>&1 | grep -v " validates$$"; \
|
---|
224 | if test $${?} -ne 0; then true; else false; fi
|
---|
225 | @echo "You can now look at $(TROUBLEDIR)/dump-$(arch) to see the errors"
|
---|
226 |
|
---|
227 | ARCHS_DUMP := $(ARCHS:%=%-dump)
|
---|
228 | .PHONY: dump-commands $(ARCHS_DUMP)
|
---|
229 | dump-commands: $(ARCHS_DUMP)
|
---|
230 | $(ARCHS_DUMP): override arch = $(@:%-dump=%)
|
---|
231 | $(ARCHS_DUMP):
|
---|
232 | @echo "Extracting commands from $(arch)..."
|
---|
233 | $(Q)mkdir -p $(DUMPDIR)/$(arch)
|
---|
234 | $(Q)xsltproc --xinclude --nonet \
|
---|
235 | --output $(DUMPDIR)/$(arch)/ \
|
---|
236 | $(TOP)/stylesheets/dump-commands.xsl \
|
---|
237 | $(TOP)/$(arch)-index.xml
|
---|
238 |
|
---|
239 | ARCHS_DLLIST := $(ARCHS:%=%-dllist)
|
---|
240 | .PHONY: download-list $(ARCHS_DLLIST)
|
---|
241 | download-list: $(ARCHS_DLLIST)
|
---|
242 | $(ARCHS_DLLIST): override arch = $(@:%-dllist=%)
|
---|
243 | $(ARCHS_DLLIST):
|
---|
244 | @echo "Creating download list for $(arch)..."
|
---|
245 | $(Q)mkdir -p $(DLLISTDIR)
|
---|
246 | $(Q)xsltproc --xinclude --nonet \
|
---|
247 | --output $(DLLISTDIR)/$(arch).list \
|
---|
248 | $(TOP)/stylesheets/wget.xsl \
|
---|
249 | $(TOP)/$(arch)-index.xml
|
---|
250 |
|
---|
251 | ARCHS_MD5LIST := $(ARCHS:%=%-md5list)
|
---|
252 | .PHONY: md5-list $(ARCHS_MD5LIST)
|
---|
253 | md5-list: $(ARCHS_MD5LIST)
|
---|
254 | $(ARCHS_MD5LIST): override arch = $(@:%-md5list=%)
|
---|
255 | $(ARCHS_MD5LIST):
|
---|
256 | @echo "Creating md5 hash list for $(arch)..."
|
---|
257 | $(Q)mkdir -p $(DLLISTDIR)
|
---|
258 | $(Q)xsltproc --xinclude --nonet \
|
---|
259 | --output $(DLLISTDIR)/$(arch).md5sum \
|
---|
260 | $(TOP)/stylesheets/md5sum.xsl \
|
---|
261 | $(TOP)/$(arch)-index.xml
|
---|
262 |
|
---|
263 | FG_GREEN := $(shell echo -e '\e[0;32m')
|
---|
264 | FG_BLUE := $(shell echo -e '\e[0;34m')
|
---|
265 | FG_DEFAULT := $(shell echo -e '\e[0;0m')
|
---|
266 | help:
|
---|
267 | @echo "Output: $(RENDERDIR)"
|
---|
268 | @echo
|
---|
269 | @echo "HTML Targets"
|
---|
270 | @echo " $(FG_GREEN)clfs lfs tidy html render titlepage $(FG_BLUE)$(ARCHS_HTML)$(FG_DEFAULT)"
|
---|
271 | @echo
|
---|
272 | @echo "NoChunks Targets"
|
---|
273 | @echo " $(FG_GREEN)nochunks tidy $(FG_BLUE)$(ARCHS_NOCHUNKS)$(FG_DEFAULT)"
|
---|
274 | @echo
|
---|
275 | @echo "FO Targets"
|
---|
276 | @echo " $(FG_GREEN)fo $(FG_BLUE)$(ARCHS_FO)$(FG_DEFAULT)"
|
---|
277 | @echo
|
---|
278 | @echo "PDF Targets"
|
---|
279 | @echo " $(FG_GREEN)pdf $(FG_BLUE)$(ARCHS_PDF)$(FG_DEFAULT)"
|
---|
280 | @echo
|
---|
281 | @echo "Validate Targets"
|
---|
282 | @echo " $(FG_GREEN)validate $(FG_BLUE)$(ARCHS_VALIDATE)$(FG_DEFAULT)"
|
---|
283 | @echo
|
---|
284 | @echo "Trouble Targets"
|
---|
285 | @echo " $(FG_GREEN)trouble $(FG_BLUE)$(ARCHS_TROUBLE)$(FG_DEFAULT)"
|
---|
286 | @echo
|
---|
287 | @echo "Dump-Commands Targets"
|
---|
288 | @echo " $(FG_GREEN)dump-commands $(FG_BLUE)$(ARCHS_DUMP)$(FG_DEFAULT)"
|
---|
289 | @echo
|
---|
290 | @echo "Download-List Targets"
|
---|
291 | @echo " $(FG_GREEN)download-list $(FG_BLUE)$(ARCHS_DLLIST)$(FG_DEFAULT)"
|
---|
292 | @echo
|
---|
293 | @echo "md5-List Targets"
|
---|
294 | @echo " $(FG_GREEN)md5-list $(FG_BLUE)$(ARCHS_MD5LIST)$(FG_DEFAULT)"
|
---|