source: BOOK/Makefile@ a5e2198

Last change on this file since a5e2198 was a5e2198, checked in by Chris Staub <chris@…>, 10 years ago

Update

  • Property mode set to 100644
File size: 7.8 KB
Line 
1TOP := $(shell pwd)
2RENDERDIR := $(TOP)/../render
3
4VALIDATEDIR := $(RENDERDIR)/validate
5PROFILEDIR := $(RENDERDIR)/profile
6
7HTMLDIR := $(RENDERDIR)/html
8NOCHUNKDIR := $(RENDERDIR)/nochunk
9
10FODIR := $(RENDERDIR)/fo
11PDFDIR := $(RENDERDIR)/pdf
12
13TROUBLEDIR := $(RENDERDIR)/trouble
14DUMPDIR := $(RENDERDIR)/commands
15DLLISTDIR := $(RENDERDIR)/download-list
16
17CHUNK_QUIET := 1
18ROOT_ID :=
19
20ARCHS := x86 x86_64 x86_64-64 \
21 sparc sparc64 sparc64-64 \
22 mips mips64 mips64-64 \
23 ppc ppc64 ppc64-64
24
25ifdef V
26 Q =
27else
28 Q = @
29endif
30
31.PHONY: clfs lfs
32clfs lfs: html
33
34.PHONY: tidy tidy-f tidy-d
35ifeq ($(shell which tidy >/dev/null 2>&1 && echo yes),yes)
36tidy:
37 @$(MAKE) --no-print-directory tidy-d TIDY_DIR=$(HTMLDIR)
38
39tidy-f:
40 @echo "Running tidy on F:$(shell basename $(TIDY_FILE))"
41 @$(TOP)/tidy.sh "$(TIDY_FILE)"
42
43tidy-d:
44 @echo "Running tidy on D:$(shell basename $(TIDY_DIR))"
45 @$(TOP)/tidy.sh "$(TIDY_DIR)"
46else
47tidy tidy-f tidy-d:
48 @echo "Tidy is not installed on this system"
49endif
50
51.PHONY: titlepage
52titlepage:
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
59ARCHS_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
70ARCHS_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
82ARCHS_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
94ARCHS_HTML := $(ARCHS:%=%-html)
95.PHONY: html render $(ARCHS_HTML)
96html 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
119ARCHS_NOCHUNKS := $(ARCHS:%=%-nochunks)
120.PHONY: nochunks $(ARCHS_NOCHUNKS)
121nochunks: $(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
135ARCHS_FO := $(ARCHS:%=%-fo)
136.PHONY: fo $(ARCHS_FO)
137fo: $(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
150ARCHS_PDF := $(ARCHS:%=%-pdf)
151.PHONY: pdf $(ARCHS_PDF)
152pdf: $(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
161ARCHS_VALIDATE := $(ARCHS:%=%-validate)
162.PHONY: validate $(ARCHS_VALIDATE)
163validate: $(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
171ARCHS_TROUBLE := $(ARCHS:%=%-trouble)
172.PHONY: trouble $(ARCHS_TROUBLE)
173trouble: $(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
187ARCHS_DUMP := $(ARCHS:%=%-dump)
188.PHONY: dump-commands $(ARCHS_DUMP)
189dump-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
199ARCHS_DLLIST := $(ARCHS:%=%-dllist)
200.PHONY: download-list $(ARCHS_DLLIST)
201download-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
211ARCHS_MD5LIST := $(ARCHS:%=%-md5list)
212.PHONY: md5-list $(ARCHS_MD5LIST)
213md5-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
223FG_GREEN := $(shell echo -e '\e[0;32m')
224FG_BLUE := $(shell echo -e '\e[0;34m')
225FG_DEFAULT := $(shell echo -e '\e[0;0m')
226help:
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)"
Note: See TracBrowser for help on using the repository browser.