source: BOOK/Makefile@ 66a06a6

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since 66a06a6 was da28cc3, checked in by Joe Ciccone <jciccone@…>, 14 years ago

Validate the book against relax-ng instead of the
standard DTD.

  • Property mode set to 100644
File size: 6.9 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):
[b47a4a1]64 @echo "Validating $(arch) book..."
[879785b]65 $(Q)mkdir -p $(VALIDATEDIR)
[da28cc3]66 $(Q)xmllint --nonet --noent --xinclude \
67 --relaxng $(TOP)/schema/docbook/4.5/rng/docbook.rng \
[879785b]68 -o $(VALIDATEDIR)/$(arch)-full.xml \
69 $(PWD)/$(arch)-index.xml
[ff39de2]70
[879785b]71ARCHS_P_XML := $(ARCHS:%=%-profiled-xml)
[b47a4a1]72.PHONY: $(ARCHS_P_XML)
73$(ARCHS_P_XML): override arch = $(@:%-profiled-xml=%)
[879785b]74$(ARCHS_P_XML):
[b47a4a1]75 @$(MAKE) --no-print-directory $(arch)-validate_dump-xml
[879785b]76 @echo "Generating profiled $(arch) book..."
77 $(Q)mkdir -p $(PROFILEDIR)
[fd5c672]78 $(Q)xsltproc --nonet --stringparam profile.condition html \
[879785b]79 --output $(PROFILEDIR)/$(arch)-html.xml \
80 $(PWD)/stylesheets/lfs-xsl/profile.xsl \
81 $(VALIDATEDIR)/$(arch)-full.xml
[bc7834d]82
[879785b]83ARCHS_HTML := $(ARCHS:%=%-html)
84.PHONY: html render $(ARCHS_HTML)
85html render: $(ARCHS_HTML) titlepage
[b47a4a1]86$(ARCHS_HTML): override arch = $(@:%-html=%)
[879785b]87$(ARCHS_HTML):
[b47a4a1]88 @$(MAKE) --no-print-directory $(arch)-profiled-xml
[fd5c672]89
[b47a4a1]90 @echo "Rendering chunked XHTML of $(arch)..."
[879785b]91 $(Q)mkdir -p $(HTMLDIR)/$(arch)
[fd5c672]92 $(Q)xsltproc --nonet -stringparam chunk.quietly $(CHUNK_QUIET) \
93 -stringparam rootid "$(ROOT_ID)" \
[879785b]94 -stringparam base.dir $(HTMLDIR)/$(arch)/ \
95 $(PWD)/stylesheets/clfs-chunked.xsl \
96 $(PROFILEDIR)/$(arch)-html.xml
[fd5c672]97
[b47a4a1]98 @echo "Copying CSS code and images for $(arch)..."
[879785b]99 $(Q)mkdir -p $(HTMLDIR)/$(arch)/stylesheets
100 $(Q)cp $(PWD)/stylesheets/lfs-xsl/*.css $(HTMLDIR)/$(arch)/stylesheets
101 $(Q)sed -i -e "s@../stylesheets@stylesheets@g" $(HTMLDIR)/$(arch)/*.html
102 $(Q)mkdir -p $(HTMLDIR)/$(arch)/images
103 $(Q)cp $(PWD)/images/*.png $(HTMLDIR)/$(arch)/images
104 $(Q)sed -i -e "s@../images@images@g" $(HTMLDIR)/$(arch)/*.html
105
106 @$(MAKE) --no-print-directory tidy-d TIDY_DIR=$(HTMLDIR)/$(arch)
107
108ARCHS_NOCHUNKS := $(ARCHS:%=%-nochunks)
109.PHONY: nochunks $(ARCHS_NOCHUNKS)
110nochunks: $(ARCHS_NOCHUNKS)
[b47a4a1]111$(ARCHS_NOCHUNKS): override arch = $(@:%-nochunks=%)
[879785b]112$(ARCHS_NOCHUNKS):
[b47a4a1]113 @$(MAKE) --no-print-directory $(arch)-profiled-xml
[fd5c672]114
[b47a4a1]115 @echo "Rendering Single File HTML of $(arch)..."
[879785b]116 $(Q)mkdir -p $(NOCHUNKDIR)
[fd5c672]117 $(Q)xsltproc --nonet -stringparam rootid "$(ROOT_ID)" \
[879785b]118 --output $(NOCHUNKDIR)/CLFS-$(arch).html \
119 $(PWD)/stylesheets/clfs-nochunks.xsl \
120 $(PROFILEDIR)/$(arch)-html.xml
[fd5c672]121
[879785b]122 @$(MAKE) --no-print-directory tidy-f TIDY_FILE=$(NOCHUNKDIR)/CLFS-$(arch).html
[157ab39]123
[879785b]124ARCHS_FO := $(ARCHS:%=%-fo)
125.PHONY: fo $(ARCHS_FO)
126fo: $(ARCHS_FO)
127$(ARCHS_FO): override arch = $(@:%-fo=%)
128$(ARCHS_FO):
[b47a4a1]129 @$(MAKE) --no-print-directory $(arch)-profiled-xml
[fd5c672]130
[b47a4a1]131 @echo "Generating FO file of $(arch)..."
[879785b]132 @mkdir -p $(FODIR)
[fd5c672]133 $(Q)xsltproc --nonet -stringparam rootid "$(ROOT_ID)" \
[879785b]134 --output $(FODIR)/$(arch).fo \
135 $(PWD)/stylesheets/clfs-pdf.xsl \
136 $(PROFILEDIR)/$(arch)-html.xml
137 $(Q)sed -i -e 's/span="inherit"/span="all"/' $(FODIR)/$(arch).fo
138
139ARCHS_PDF := $(ARCHS:%=%-pdf)
140.PHONY: pdf $(ARCHS_PDF)
141pdf: $(ARCHS_PDF)
142$(ARCHS_PDF): override arch = $(@:%-pdf=%)
143$(ARCHS_PDF):
144 @$(MAKE) --no-print-directory $(arch)-fo
[157ab39]145
[b47a4a1]146 @echo "Rendering PDF of $(arch)..."
[879785b]147 $(Q)mkdir -p $(PDFDIR)
148 $(Q)fop $(FODIR)/$(arch).fo $(PDFDIR)/CLFS-$(arch).pdf
[157ab39]149
[879785b]150ARCHS_VALIDATE := $(ARCHS:%=%-validate)
151.PHONY: validate $(ARCHS_VALIDATE)
152validate: $(ARCHS_VALIDATE)
[b47a4a1]153$(ARCHS_VALIDATE): override arch = $(@:%-validate=%)
[157ab39]154$(ARCHS_VALIDATE):
[b47a4a1]155 @echo "Validating $(arch)..."
[da28cc3]156 $(Q)xmllint --xinclude --noout --nonet \
157 --relaxng $(TOP)/schema/docbook/4.5/rng/docbook.rng \
[879785b]158 $(PWD)/$(arch)-index.xml
159
160ARCHS_TROUBLE := $(ARCHS:%=%-trouble)
161.PHONY: trouble $(ARCHS_TROUBLE)
162trouble: $(ARCHS_TROUBLE)
163$(ARCHS_TROUBLE): override arch = $(@:%-trouble=%)
164$(ARCHS_TROUBLE):
165 @echo "Troubleshooting $(arch)..."
166 @mkdir -p $(TROUBLEDIR)
[da28cc3]167 $(Q)xmllint --xinclude --nonet \
168 --relaxng $(TOP)/schema/docbook/4.5/rng/docbook.rng \
[879785b]169 -o $(TROUBLEDIR)/dump-$(arch) \
170 $(PWD)/$(arch)-index.xml
[da28cc3]171 $(Q)xmllint --xinclude --noout --nonet \
172 --relaxng $(TOP)/schema/docbook/4.5/rng/docbook.rng \
[879785b]173 $(TROUBLEDIR)/dump-$(arch)
174 @echo "You can now look at $(TROUBLEDIR)/dump-$(arch) to see the errors"
175
176ARCHS_DUMP := $(ARCHS:%=%-dump)
177.PHONY: dump-commands $(ARCHS_DUMP)
178dump-commands: $(ARCHS_DUMP)
179$(ARCHS_DUMP): override arch = $(@:%-dump=%)
[157ab39]180$(ARCHS_DUMP):
[b47a4a1]181 @echo "Extracting commands from $(arch)..."
182 $(Q)mkdir -p $(DUMPDIR)/$(arch)
[879785b]183 $(Q)xsltproc --xinclude --nonet \
184 --output $(DUMPDIR)/$(arch)/ \
185 $(PWD)/stylesheets/dump-commands.xsl \
186 $(PWD)/$(arch)-index.xml
[157ab39]187
[879785b]188ARCHS_DLLIST := $(ARCHS:%=%-dllist)
189.PHONY: download-list $(ARCHS_DLLIST)
190download-list: $(ARCHS_DLLIST)
[b47a4a1]191$(ARCHS_DLLIST): override arch = $(@:%-dllist=%)
[157ab39]192$(ARCHS_DLLIST):
[b47a4a1]193 @echo "Creating download list for $(arch)..."
[fd5c672]194 $(Q)mkdir -p $(DLLISTDIR)
[879785b]195 $(Q)xsltproc --xinclude --nonet \
196 --output $(DLLISTDIR)/$(arch).list \
197 $(PWD)/stylesheets/wget.xsl \
198 $(PWD)/$(arch)-index.xml
199
200FG_GREEN := $(shell echo -e '\e[0;32m')
201FG_BLUE := $(shell echo -e '\e[0;34m')
202FG_DEFAULT := $(shell echo -e '\e[0;0m')
[07114c98]203help:
[879785b]204 @echo "Output: $(RENDERDIR)"
[2b77c9d4]205 @echo
[157ab39]206 @echo "HTML Targets"
[879785b]207 @echo " $(FG_GREEN)clfs lfs tidy html render titlepage $(FG_BLUE)$(ARCHS_HTML)$(FG_DEFAULT)"
[157ab39]208 @echo
209 @echo "NoChunks Targets"
[b47a4a1]210 @echo " $(FG_GREEN)nochunks tidy $(FG_BLUE)$(ARCHS_NOCHUNKS)$(FG_DEFAULT)"
[157ab39]211 @echo
[879785b]212 @echo "FO Targets"
213 @echo " $(FG_GREEN)fo $(FG_BLUE)$(ARCHS_FO)$(FG_DEFAULT)"
214 @echo
[157ab39]215 @echo "PDF Targets"
[b47a4a1]216 @echo " $(FG_GREEN)pdf $(FG_BLUE)$(ARCHS_PDF)$(FG_DEFAULT)"
[157ab39]217 @echo
218 @echo "Validate Targets"
[b47a4a1]219 @echo " $(FG_GREEN)validate $(FG_BLUE)$(ARCHS_VALIDATE)$(FG_DEFAULT)"
[157ab39]220 @echo
221 @echo "Trouble Targets"
[b47a4a1]222 @echo " $(FG_GREEN)trouble $(FG_BLUE)$(ARCHS_TROUBLE)$(FG_DEFAULT)"
[157ab39]223 @echo
224 @echo "Dump-Commands Targets"
[b47a4a1]225 @echo " $(FG_GREEN)dump-commands $(FG_BLUE)$(ARCHS_DUMP)$(FG_DEFAULT)"
[157ab39]226 @echo
227 @echo "Download-List Targets"
[b47a4a1]228 @echo " $(FG_GREEN)download-list $(FG_BLUE)$(ARCHS_DLLIST)$(FG_DEFAULT)"
Note: See TracBrowser for help on using the repository browser.