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