source: BOOK/Makefile@ 33cb2bd

Last change on this file since 33cb2bd was 4fe47e3, checked in by Joe Ciccone <jciccone@…>, 14 years ago

Add the initial changes for a new xml format for the packages part
of the book. This is still preliminary and currently is pretty
broken, more to come in the future as bugs get squashed.

  • Property mode set to 100644
File size: 8.5 KB
Line 
1TOP := $(PWD)
2RENDERDIR := $(TOP)/../render
3
4VALIDATEDIR := $(RENDERDIR)/validate
5DBXMLDIR := $(RENDERDIR)/docbook
6PROFILEDIR := $(RENDERDIR)/profile
7
8HTMLDIR := $(RENDERDIR)/html
9NOCHUNKDIR := $(RENDERDIR)/nochunk
10
11FODIR := $(RENDERDIR)/fo
12PDFDIR := $(RENDERDIR)/pdf
13
14TROUBLEDIR := $(RENDERDIR)/trouble
15DUMPDIR := $(RENDERDIR)/commands
16DLLISTDIR := $(RENDERDIR)/download-list
17
18CHUNK_QUIET := 1
19ROOT_ID :=
20
21ARCHS := x86 x86_64 x86_64-64 \
22 sparc sparc64 sparc64-64 \
23 mips mips64 mips64-64 \
24 ppc ppc64 \
25 alpha
26
27x86_ML := 32
28x86_64_ML := 32,64
29x86_64-64_ML := 64
30sparc_ML := 32
31sparc64_ML := 32,64
32sparc64-64_ML := 64
33mips_ML := 32
34mips64_ML := 32,n32,64
35mips64-64_ML := 64
36ppc_ML := 32
37ppc64_ML := 32,64
38alpha_ML := 64
39
40ifdef V
41 Q =
42else
43 Q = @
44endif
45
46.PHONY: clfs lfs
47clfs lfs: html
48
49.PHONY: tidy tidy-f tidy-d
50ifeq ($(shell which tidy >/dev/null 2>&1 && echo yes),yes)
51tidy:
52 @$(MAKE) --no-print-directory tidy-d TIDY_DIR=$(HTMLDIR)
53
54tidy-f:
55 @echo "Running tidy on F:$(shell basename $(TIDY_FILE))"
56 @$(TOP)/tidy.sh "$(TIDY_FILE)"
57
58tidy-d:
59 @echo "Running tidy on D:$(shell basename $(TIDY_DIR))"
60 @$(TOP)/tidy.sh "$(TIDY_DIR)"
61else
62tidy tidy-f tidy-d:
63 @echo "Tidy is not installed on this system"
64endif
65
66.PHONY: titlepage
67titlepage:
68 @echo "Rendering the top-level index..."
69 $(Q)xsltproc --nonet --output $(HTMLDIR)/index.html \
70 $(PWD)/stylesheets/top-index.xsl \
71 $(PWD)/index.xml
72 @$(MAKE) --no-print-directory tidy-f TIDY_FILE=$(HTMLDIR)/index.html
73
74ARCHS_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 $(PWD)/$(arch)-index.xml \
84 2>&1 | grep -v " validates$$"; \
85 if test $${?} -ne 0; then true; else false; fi
86
87ARCHS_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 $(PWD)/stylesheets/clfs-profile.xsl \
99 $(VALIDATEDIR)/$(arch)-full.xml
100
101ARCHS_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 $(PWD)/stylesheets/lfs-xsl/profile.xsl \
112 $(DBXMLDIR)/$(arch)-db.xml
113
114ARCHS_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
125ARCHS_HTML := $(ARCHS:%=%-html)
126.PHONY: html render $(ARCHS_HTML)
127html 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 $(PWD)/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 $(PWD)/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 $(PWD)/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
151ARCHS_NOCHUNKS := $(ARCHS:%=%-nochunks)
152.PHONY: nochunks $(ARCHS_NOCHUNKS)
153nochunks: $(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 $(PWD)/stylesheets/clfs-nochunks.xsl \
164 $(PROFILEDIR)/$(arch)-html.xml
165
166 @$(MAKE) --no-print-directory tidy-f TIDY_FILE=$(NOCHUNKDIR)/CLFS-$(arch).html
167
168ARCHS_FO := $(ARCHS:%=%-fo)
169.PHONY: fo $(ARCHS_FO)
170fo: $(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 $(PWD)/stylesheets/clfs-pdf.xsl \
181 $(PROFILEDIR)/$(arch)-html.xml
182 $(Q)sed -i -e 's/span="inherit"/span="all"/' $(FODIR)/$(arch).fo
183
184ARCHS_PDF := $(ARCHS:%=%-pdf)
185.PHONY: pdf $(ARCHS_PDF)
186pdf: $(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
195ARCHS_VALIDATE := $(ARCHS:%=%-validate)
196.PHONY: validate $(ARCHS_VALIDATE)
197validate: $(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 $(PWD)/$(arch)-index.xml \
204 2>&1 | grep -v " validates$$"; \
205 if test $${?} -ne 0; then true; else false; fi
206
207ARCHS_TROUBLE := $(ARCHS:%=%-trouble)
208.PHONY: trouble $(ARCHS_TROUBLE)
209trouble: $(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 $(PWD)/$(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
227ARCHS_DUMP := $(ARCHS:%=%-dump)
228.PHONY: dump-commands $(ARCHS_DUMP)
229dump-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 $(PWD)/stylesheets/dump-commands.xsl \
237 $(PWD)/$(arch)-index.xml
238
239ARCHS_DLLIST := $(ARCHS:%=%-dllist)
240.PHONY: download-list $(ARCHS_DLLIST)
241download-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 $(PWD)/stylesheets/wget.xsl \
249 $(PWD)/$(arch)-index.xml
250
251FG_GREEN := $(shell echo -e '\e[0;32m')
252FG_BLUE := $(shell echo -e '\e[0;34m')
253FG_DEFAULT := $(shell echo -e '\e[0;0m')
254help:
255 @echo "Output: $(RENDERDIR)"
256 @echo
257 @echo "HTML Targets"
258 @echo " $(FG_GREEN)clfs lfs tidy html render titlepage $(FG_BLUE)$(ARCHS_HTML)$(FG_DEFAULT)"
259 @echo
260 @echo "NoChunks Targets"
261 @echo " $(FG_GREEN)nochunks tidy $(FG_BLUE)$(ARCHS_NOCHUNKS)$(FG_DEFAULT)"
262 @echo
263 @echo "FO Targets"
264 @echo " $(FG_GREEN)fo $(FG_BLUE)$(ARCHS_FO)$(FG_DEFAULT)"
265 @echo
266 @echo "PDF Targets"
267 @echo " $(FG_GREEN)pdf $(FG_BLUE)$(ARCHS_PDF)$(FG_DEFAULT)"
268 @echo
269 @echo "Validate Targets"
270 @echo " $(FG_GREEN)validate $(FG_BLUE)$(ARCHS_VALIDATE)$(FG_DEFAULT)"
271 @echo
272 @echo "Trouble Targets"
273 @echo " $(FG_GREEN)trouble $(FG_BLUE)$(ARCHS_TROUBLE)$(FG_DEFAULT)"
274 @echo
275 @echo "Dump-Commands Targets"
276 @echo " $(FG_GREEN)dump-commands $(FG_BLUE)$(ARCHS_DUMP)$(FG_DEFAULT)"
277 @echo
278 @echo "Download-List Targets"
279 @echo " $(FG_GREEN)download-list $(FG_BLUE)$(ARCHS_DLLIST)$(FG_DEFAULT)"
Note: See TracBrowser for help on using the repository browser.