source: BOOK/Makefile@ d66ee74

Last change on this file since d66ee74 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
RevLine 
[2b77c9d4]1TOP := $(PWD)
[879785b]2RENDERDIR := $(TOP)/../render
[2b77c9d4]3
[879785b]4VALIDATEDIR := $(RENDERDIR)/validate
[4fe47e3]5DBXMLDIR := $(RENDERDIR)/docbook
[879785b]6PROFILEDIR := $(RENDERDIR)/profile
[2b77c9d4]7
[879785b]8HTMLDIR := $(RENDERDIR)/html
9NOCHUNKDIR := $(RENDERDIR)/nochunk
10
11FODIR := $(RENDERDIR)/fo
12PDFDIR := $(RENDERDIR)/pdf
13
14TROUBLEDIR := $(RENDERDIR)/trouble
15DUMPDIR := $(RENDERDIR)/commands
16DLLISTDIR := $(RENDERDIR)/download-list
[157ab39]17
[879785b]18CHUNK_QUIET := 1
19ROOT_ID :=
[157ab39]20
[b47a4a1]21ARCHS := x86 x86_64 x86_64-64 \
22 sparc sparc64 sparc64-64 \
23 mips mips64 mips64-64 \
24 ppc ppc64 \
25 alpha
[157ab39]26
[4fe47e3]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
[fd5c672]40ifdef V
41 Q =
42else
43 Q = @
44endif
45
[879785b]46.PHONY: clfs lfs
47clfs lfs: html
[157ab39]48
[b47a4a1]49.PHONY: tidy tidy-f tidy-d
[157ab39]50ifeq ($(shell which tidy >/dev/null 2>&1 && echo yes),yes)
51tidy:
[879785b]52 @$(MAKE) --no-print-directory tidy-d TIDY_DIR=$(HTMLDIR)
[c695188]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)"
[157ab39]61else
[c695188]62tidy tidy-f tidy-d:
[fd5c672]63 @echo "Tidy is not installed on this system"
[157ab39]64endif
65
[b47a4a1]66.PHONY: titlepage
[157ab39]67titlepage:
[c695188]68 @echo "Rendering the top-level index..."
[879785b]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
[b47a4a1]73
[879785b]74ARCHS_VD_XML := $(ARCHS:%=%-validate_dump-xml)
[b47a4a1]75.PHONY: $(ARCHS_VD_XML)
76$(ARCHS_VD_XML): override arch = $(@:%-validate_dump-xml=%)
[879785b]77$(ARCHS_VD_XML):
[eef46e9]78 @echo "Validating $(arch) against the CLFS Schema..."
[879785b]79 $(Q)mkdir -p $(VALIDATEDIR)
[da28cc3]80 $(Q)xmllint --nonet --noent --xinclude \
[eef46e9]81 --relaxng $(TOP)/schema/clfs/0.1/rng/clfs.rng \
[879785b]82 -o $(VALIDATEDIR)/$(arch)-full.xml \
[eef46e9]83 $(PWD)/$(arch)-index.xml \
84 2>&1 | grep -v " validates$$"; \
85 if test $${?} -ne 0; then true; else false; fi
[ff39de2]86
[4fe47e3]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
[879785b]101ARCHS_P_XML := $(ARCHS:%=%-profiled-xml)
[b47a4a1]102.PHONY: $(ARCHS_P_XML)
103$(ARCHS_P_XML): override arch = $(@:%-profiled-xml=%)
[879785b]104$(ARCHS_P_XML):
[4fe47e3]105 @$(MAKE) --no-print-directory $(arch)-db-xml
[eef46e9]106 @echo "Profiling $(arch) for rendering..."
[879785b]107 $(Q)mkdir -p $(PROFILEDIR)
[4fe47e3]108 $(Q)xsltproc --nonet \
109 --stringparam profile.condition html \
[879785b]110 --output $(PROFILEDIR)/$(arch)-html.xml \
111 $(PWD)/stylesheets/lfs-xsl/profile.xsl \
[4fe47e3]112 $(DBXMLDIR)/$(arch)-db.xml
[bc7834d]113
[eef46e9]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 \
[4fe47e3]121 $(PROFILEDIR)/$(arch)-html.xml \
[eef46e9]122 2>&1 | grep -v " validates$$"; \
123 if test $${?} -ne 0; then true; else false; fi
124
[879785b]125ARCHS_HTML := $(ARCHS:%=%-html)
126.PHONY: html render $(ARCHS_HTML)
127html render: $(ARCHS_HTML) titlepage
[b47a4a1]128$(ARCHS_HTML): override arch = $(@:%-html=%)
[879785b]129$(ARCHS_HTML):
[b47a4a1]130 @$(MAKE) --no-print-directory $(arch)-profiled-xml
[eef46e9]131 @$(MAKE) --no-print-directory $(arch)-validate_db-xml
[fd5c672]132
[b47a4a1]133 @echo "Rendering chunked XHTML of $(arch)..."
[879785b]134 $(Q)mkdir -p $(HTMLDIR)/$(arch)
[fd5c672]135 $(Q)xsltproc --nonet -stringparam chunk.quietly $(CHUNK_QUIET) \
136 -stringparam rootid "$(ROOT_ID)" \
[879785b]137 -stringparam base.dir $(HTMLDIR)/$(arch)/ \
138 $(PWD)/stylesheets/clfs-chunked.xsl \
139 $(PROFILEDIR)/$(arch)-html.xml
[fd5c672]140
[b47a4a1]141 @echo "Copying CSS code and images for $(arch)..."
[879785b]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)
[b47a4a1]154$(ARCHS_NOCHUNKS): override arch = $(@:%-nochunks=%)
[879785b]155$(ARCHS_NOCHUNKS):
[b47a4a1]156 @$(MAKE) --no-print-directory $(arch)-profiled-xml
[eef46e9]157 @$(MAKE) --no-print-directory $(arch)-validate_db-xml
[fd5c672]158
[b47a4a1]159 @echo "Rendering Single File HTML of $(arch)..."
[879785b]160 $(Q)mkdir -p $(NOCHUNKDIR)
[fd5c672]161 $(Q)xsltproc --nonet -stringparam rootid "$(ROOT_ID)" \
[879785b]162 --output $(NOCHUNKDIR)/CLFS-$(arch).html \
163 $(PWD)/stylesheets/clfs-nochunks.xsl \
164 $(PROFILEDIR)/$(arch)-html.xml
[fd5c672]165
[879785b]166 @$(MAKE) --no-print-directory tidy-f TIDY_FILE=$(NOCHUNKDIR)/CLFS-$(arch).html
[157ab39]167
[879785b]168ARCHS_FO := $(ARCHS:%=%-fo)
169.PHONY: fo $(ARCHS_FO)
170fo: $(ARCHS_FO)
171$(ARCHS_FO): override arch = $(@:%-fo=%)
172$(ARCHS_FO):
[b47a4a1]173 @$(MAKE) --no-print-directory $(arch)-profiled-xml
[eef46e9]174 @$(MAKE) --no-print-directory $(arch)-validate_db-xml
[fd5c672]175
[b47a4a1]176 @echo "Generating FO file of $(arch)..."
[879785b]177 @mkdir -p $(FODIR)
[fd5c672]178 $(Q)xsltproc --nonet -stringparam rootid "$(ROOT_ID)" \
[879785b]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
[157ab39]190
[b47a4a1]191 @echo "Rendering PDF of $(arch)..."
[879785b]192 $(Q)mkdir -p $(PDFDIR)
193 $(Q)fop $(FODIR)/$(arch).fo $(PDFDIR)/CLFS-$(arch).pdf
[157ab39]194
[879785b]195ARCHS_VALIDATE := $(ARCHS:%=%-validate)
196.PHONY: validate $(ARCHS_VALIDATE)
197validate: $(ARCHS_VALIDATE)
[b47a4a1]198$(ARCHS_VALIDATE): override arch = $(@:%-validate=%)
[157ab39]199$(ARCHS_VALIDATE):
[eef46e9]200 @echo "Validating $(arch) against the CLFS Schema..."
[da28cc3]201 $(Q)xmllint --xinclude --noout --nonet \
[eef46e9]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
[879785b]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)
[da28cc3]214 $(Q)xmllint --xinclude --nonet \
[eef46e9]215 --relaxng $(TOP)/schema/clfs/0.1/rng/clfs.rng \
[879785b]216 -o $(TROUBLEDIR)/dump-$(arch) \
[eef46e9]217 $(PWD)/$(arch)-index.xml \
218 2>&1 | grep -v " validates$$"; \
219 if test $${?} -ne 0; then true; else false; fi
[da28cc3]220 $(Q)xmllint --xinclude --noout --nonet \
[eef46e9]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
[879785b]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=%)
[157ab39]231$(ARCHS_DUMP):
[b47a4a1]232 @echo "Extracting commands from $(arch)..."
233 $(Q)mkdir -p $(DUMPDIR)/$(arch)
[879785b]234 $(Q)xsltproc --xinclude --nonet \
235 --output $(DUMPDIR)/$(arch)/ \
236 $(PWD)/stylesheets/dump-commands.xsl \
237 $(PWD)/$(arch)-index.xml
[157ab39]238
[879785b]239ARCHS_DLLIST := $(ARCHS:%=%-dllist)
240.PHONY: download-list $(ARCHS_DLLIST)
241download-list: $(ARCHS_DLLIST)
[b47a4a1]242$(ARCHS_DLLIST): override arch = $(@:%-dllist=%)
[157ab39]243$(ARCHS_DLLIST):
[b47a4a1]244 @echo "Creating download list for $(arch)..."
[fd5c672]245 $(Q)mkdir -p $(DLLISTDIR)
[879785b]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')
[07114c98]254help:
[879785b]255 @echo "Output: $(RENDERDIR)"
[2b77c9d4]256 @echo
[157ab39]257 @echo "HTML Targets"
[879785b]258 @echo " $(FG_GREEN)clfs lfs tidy html render titlepage $(FG_BLUE)$(ARCHS_HTML)$(FG_DEFAULT)"
[157ab39]259 @echo
260 @echo "NoChunks Targets"
[b47a4a1]261 @echo " $(FG_GREEN)nochunks tidy $(FG_BLUE)$(ARCHS_NOCHUNKS)$(FG_DEFAULT)"
[157ab39]262 @echo
[879785b]263 @echo "FO Targets"
264 @echo " $(FG_GREEN)fo $(FG_BLUE)$(ARCHS_FO)$(FG_DEFAULT)"
265 @echo
[157ab39]266 @echo "PDF Targets"
[b47a4a1]267 @echo " $(FG_GREEN)pdf $(FG_BLUE)$(ARCHS_PDF)$(FG_DEFAULT)"
[157ab39]268 @echo
269 @echo "Validate Targets"
[b47a4a1]270 @echo " $(FG_GREEN)validate $(FG_BLUE)$(ARCHS_VALIDATE)$(FG_DEFAULT)"
[157ab39]271 @echo
272 @echo "Trouble Targets"
[b47a4a1]273 @echo " $(FG_GREEN)trouble $(FG_BLUE)$(ARCHS_TROUBLE)$(FG_DEFAULT)"
[157ab39]274 @echo
275 @echo "Dump-Commands Targets"
[b47a4a1]276 @echo " $(FG_GREEN)dump-commands $(FG_BLUE)$(ARCHS_DUMP)$(FG_DEFAULT)"
[157ab39]277 @echo
278 @echo "Download-List Targets"
[b47a4a1]279 @echo " $(FG_GREEN)download-list $(FG_BLUE)$(ARCHS_DLLIST)$(FG_DEFAULT)"
Note: See TracBrowser for help on using the repository browser.