source: BOOK/Makefile@ eef46e9

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

Add a custom schema for CLFS as well as an intermediate target in
the Makefile that validate against this schema and then docbooks
standard schema.

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