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