source: clfs-sysroot/BOOK/Makefile

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

Integrated the Makefile from the main book.

  • Property mode set to 100644
File size: 6.6 KB
RevLine 
[4fc026e]1TOP := $(PWD)
2RENDERDIR := $(TOP)/../render
[02095ae]3
[4fc026e]4VALIDATEDIR := $(RENDERDIR)/validate
5PROFILEDIR := $(RENDERDIR)/profile
[02095ae]6
[4fc026e]7HTMLDIR := $(RENDERDIR)/html
8NOCHUNKDIR := $(RENDERDIR)/nochunk
9
10FODIR := $(RENDERDIR)/fo
11PDFDIR := $(RENDERDIR)/pdf
[02095ae]12
[4fc026e]13TROUBLEDIR := $(RENDERDIR)/trouble
14DUMPDIR := $(RENDERDIR)/commands
15DLLISTDIR := $(RENDERDIR)/download-list
16
17CHUNK_QUIET := 1
18ROOT_ID :=
19
20ARCHS := alpha arm hppa x86
[02095ae]21
[b7f86eb]22ifdef V
23 Q =
24else
25 Q = @
26endif
27
[4fc026e]28.PHONY: clfs lfs
29clfs lfs: html
[02095ae]30
[4fc026e]31.PHONY: tidy tidy-f tidy-d
[4421c53]32ifeq ($(shell which tidy >/dev/null 2>&1 && echo yes),yes)
[02095ae]33tidy:
[4fc026e]34 @$(MAKE) --no-print-directory tidy-d TIDY_DIR=$(HTMLDIR)
35
36tidy-f:
37 @echo "Running tidy on F:$(shell basename $(TIDY_FILE))"
38 @$(TOP)/tidy.sh "$(TIDY_FILE)"
39
40tidy-d:
41 @echo "Running tidy on D:$(shell basename $(TIDY_DIR))"
42 @$(TOP)/tidy.sh "$(TIDY_DIR)"
[4421c53]43else
[4fc026e]44tidy tidy-f tidy-d:
[b7f86eb]45 @echo "Tidy is not installed on this system"
[4421c53]46endif
[02095ae]47
[4fc026e]48.PHONY: titlepage
[02095ae]49titlepage:
[4fc026e]50 @echo "Rendering the top-level index..."
51 $(Q)xsltproc --nonet --output $(HTMLDIR)/index.html \
52 $(PWD)/stylesheets/top-index.xsl \
53 $(PWD)/index.xml
54 @$(MAKE) --no-print-directory tidy-f TIDY_FILE=$(HTMLDIR)/index.html
55
56ARCHS_VD_XML := $(ARCHS:%=%-validate_dump-xml)
57.PHONY: $(ARCHS_VD_XML)
58$(ARCHS_VD_XML): override arch = $(@:%-validate_dump-xml=%)
59$(ARCHS_VD_XML):
60 @echo "Validating $(arch) book..."
61 $(Q)mkdir -p $(VALIDATEDIR)
[b7f86eb]62 $(Q)xmllint --nonet --noent --xinclude --postvalid \
[4fc026e]63 -o $(VALIDATEDIR)/$(arch)-full.xml \
64 $(PWD)/$(arch)-index.xml
65
66ARCHS_P_XML := $(ARCHS:%=%-profiled-xml)
67.PHONY: $(ARCHS_P_XML)
68$(ARCHS_P_XML): override arch = $(@:%-profiled-xml=%)
69$(ARCHS_P_XML):
70 @$(MAKE) --no-print-directory $(arch)-validate_dump-xml
71 @echo "Generating profiled $(arch) book..."
72 $(Q)mkdir -p $(PROFILEDIR)
[b7f86eb]73 $(Q)xsltproc --nonet --stringparam profile.condition html \
[4fc026e]74 --output $(PROFILEDIR)/$(arch)-html.xml \
75 $(PWD)/stylesheets/lfs-xsl/profile.xsl \
76 $(VALIDATEDIR)/$(arch)-full.xml
77
78ARCHS_HTML := $(ARCHS:%=%-html)
79.PHONY: html render $(ARCHS_HTML)
80html render: $(ARCHS_HTML) titlepage
81$(ARCHS_HTML): override arch = $(@:%-html=%)
82$(ARCHS_HTML):
83 @$(MAKE) --no-print-directory $(arch)-profiled-xml
[b7f86eb]84
[4fc026e]85 @echo "Rendering chunked XHTML of $(arch)..."
86 $(Q)mkdir -p $(HTMLDIR)/$(arch)
[b7f86eb]87 $(Q)xsltproc --nonet -stringparam chunk.quietly $(CHUNK_QUIET) \
88 -stringparam rootid "$(ROOT_ID)" \
[4fc026e]89 -stringparam base.dir $(HTMLDIR)/$(arch)/ \
90 $(PWD)/stylesheets/clfs-chunked.xsl \
91 $(PROFILEDIR)/$(arch)-html.xml
92
93 @echo "Copying CSS code and images for $(arch)..."
94 $(Q)mkdir -p $(HTMLDIR)/$(arch)/stylesheets
95 $(Q)cp $(PWD)/stylesheets/lfs-xsl/*.css $(HTMLDIR)/$(arch)/stylesheets
96 $(Q)sed -i -e "s@../stylesheets@stylesheets@g" $(HTMLDIR)/$(arch)/*.html
97 $(Q)mkdir -p $(HTMLDIR)/$(arch)/images
98 $(Q)cp $(PWD)/images/*.png $(HTMLDIR)/$(arch)/images
99 $(Q)sed -i -e "s@../images@images@g" $(HTMLDIR)/$(arch)/*.html
100
101 @$(MAKE) --no-print-directory tidy-d TIDY_DIR=$(HTMLDIR)/$(arch)
102
103ARCHS_NOCHUNKS := $(ARCHS:%=%-nochunks)
104.PHONY: nochunks $(ARCHS_NOCHUNKS)
105nochunks: $(ARCHS_NOCHUNKS)
106$(ARCHS_NOCHUNKS): override arch = $(@:%-nochunks=%)
[02095ae]107$(ARCHS_NOCHUNKS):
[4fc026e]108 @$(MAKE) --no-print-directory $(arch)-profiled-xml
[b7f86eb]109
[4fc026e]110 @echo "Rendering Single File HTML of $(arch)..."
111 $(Q)mkdir -p $(NOCHUNKDIR)
[b7f86eb]112 $(Q)xsltproc --nonet -stringparam rootid "$(ROOT_ID)" \
[4fc026e]113 --output $(NOCHUNKDIR)/CLFS-$(arch).html \
114 $(PWD)/stylesheets/clfs-nochunks.xsl \
115 $(PROFILEDIR)/$(arch)-html.xml
[b7f86eb]116
[4fc026e]117 @$(MAKE) --no-print-directory tidy-f TIDY_FILE=$(NOCHUNKDIR)/CLFS-$(arch).html
[02095ae]118
[4fc026e]119ARCHS_FO := $(ARCHS:%=%-fo)
120.PHONY: fo $(ARCHS_FO)
121fo: $(ARCHS_FO)
122$(ARCHS_FO): override arch = $(@:%-fo=%)
123$(ARCHS_FO):
124 @$(MAKE) --no-print-directory $(arch)-profiled-xml
[02095ae]125
[4fc026e]126 @echo "Generating FO file of $(arch)..."
127 @mkdir -p $(FODIR)
[b7f86eb]128 $(Q)xsltproc --nonet -stringparam rootid "$(ROOT_ID)" \
[4fc026e]129 --output $(FODIR)/$(arch).fo \
130 $(PWD)/stylesheets/clfs-pdf.xsl \
131 $(PROFILEDIR)/$(arch)-html.xml
132 $(Q)sed -i -e 's/span="inherit"/span="all"/' $(FODIR)/$(arch).fo
133
134ARCHS_PDF := $(ARCHS:%=%-pdf)
135.PHONY: pdf $(ARCHS_PDF)
136pdf: $(ARCHS_PDF)
137$(ARCHS_PDF): override arch = $(@:%-pdf=%)
138$(ARCHS_PDF):
139 @$(MAKE) --no-print-directory $(arch)-fo
[02095ae]140
[4fc026e]141 @echo "Rendering PDF of $(arch)..."
142 $(Q)mkdir -p $(PDFDIR)
143 $(Q)fop $(FODIR)/$(arch).fo $(PDFDIR)/CLFS-$(arch).pdf
[02095ae]144
[4fc026e]145ARCHS_VALIDATE := $(ARCHS:%=%-validate)
146.PHONY: validate $(ARCHS_VALIDATE)
[02095ae]147validate: $(ARCHS_VALIDATE)
[4fc026e]148$(ARCHS_VALIDATE): override arch = $(@:%-validate=%)
[02095ae]149$(ARCHS_VALIDATE):
[4fc026e]150 @echo "Validating $(arch)..."
151 $(Q)xmllint --xinclude --noout \
152 --nonet --postvalid \
153 $(PWD)/$(arch)-index.xml
154
155ARCHS_TROUBLE := $(ARCHS:%=%-trouble)
156.PHONY: trouble $(ARCHS_TROUBLE)
157trouble: $(ARCHS_TROUBLE)
158$(ARCHS_TROUBLE): override arch = $(@:%-trouble=%)
[02095ae]159$(ARCHS_TROUBLE):
[4fc026e]160 @echo "Troubleshooting $(arch)..."
161 @mkdir -p $(TROUBLEDIR)
[b7f86eb]162 $(Q)xmllint --xinclude --nonet --postvalid \
[4fc026e]163 -o $(TROUBLEDIR)/dump-$(arch) \
164 $(PWD)/$(arch)-index.xml
165 $(Q)xmllint --xinclude --noout --nonet --valid \
166 $(TROUBLEDIR)/dump-$(arch)
167 @echo "You can now look at $(TROUBLEDIR)/dump-$(arch) to see the errors"
168
169ARCHS_DUMP := $(ARCHS:%=%-dump)
170.PHONY: dump-commands $(ARCHS_DUMP)
[02095ae]171dump-commands: $(ARCHS_DUMP)
[4fc026e]172$(ARCHS_DUMP): override arch = $(@:%-dump=%)
[02095ae]173$(ARCHS_DUMP):
[4fc026e]174 @echo "Extracting commands from $(arch)..."
175 $(Q)mkdir -p $(DUMPDIR)/$(arch)
176 $(Q)xsltproc --xinclude --nonet \
177 --output $(DUMPDIR)/$(arch)/ \
178 $(PWD)/stylesheets/dump-commands.xsl \
179 $(PWD)/$(arch)-index.xml
180
181ARCHS_DLLIST := $(ARCHS:%=%-dllist)
182.PHONY: download-list $(ARCHS_DLLIST)
[02095ae]183download-list: $(ARCHS_DLLIST)
[4fc026e]184$(ARCHS_DLLIST): override arch = $(@:%-dllist=%)
[02095ae]185$(ARCHS_DLLIST):
[4fc026e]186 @echo "Creating download list for $(arch)..."
[393a3db]187 $(Q)mkdir -p $(DLLISTDIR)
[4fc026e]188 $(Q)xsltproc --xinclude --nonet \
189 --output $(DLLISTDIR)/$(arch).list \
190 $(PWD)/stylesheets/wget.xsl \
191 $(PWD)/$(arch)-index.xml
192
193FG_GREEN := $(shell echo -e '\e[0;32m')
194FG_BLUE := $(shell echo -e '\e[0;34m')
195FG_DEFAULT := $(shell echo -e '\e[0;0m')
[02095ae]196help:
[4fc026e]197 @echo "Output: $(RENDERDIR)"
198 @echo
[02095ae]199 @echo "HTML Targets"
[4fc026e]200 @echo " $(FG_GREEN)clfs lfs tidy html render titlepage $(FG_BLUE)$(ARCHS_HTML)$(FG_DEFAULT)"
[02095ae]201 @echo
202 @echo "NoChunks Targets"
[4fc026e]203 @echo " $(FG_GREEN)nochunks tidy $(FG_BLUE)$(ARCHS_NOCHUNKS)$(FG_DEFAULT)"
204 @echo
205 @echo "FO Targets"
206 @echo " $(FG_GREEN)fo $(FG_BLUE)$(ARCHS_FO)$(FG_DEFAULT)"
[02095ae]207 @echo
208 @echo "PDF Targets"
[4fc026e]209 @echo " $(FG_GREEN)pdf $(FG_BLUE)$(ARCHS_PDF)$(FG_DEFAULT)"
[02095ae]210 @echo
211 @echo "Validate Targets"
[4fc026e]212 @echo " $(FG_GREEN)validate $(FG_BLUE)$(ARCHS_VALIDATE)$(FG_DEFAULT)"
[02095ae]213 @echo
214 @echo "Trouble Targets"
[4fc026e]215 @echo " $(FG_GREEN)trouble $(FG_BLUE)$(ARCHS_TROUBLE)$(FG_DEFAULT)"
[02095ae]216 @echo
217 @echo "Dump-Commands Targets"
[4fc026e]218 @echo " $(FG_GREEN)dump-commands $(FG_BLUE)$(ARCHS_DUMP)$(FG_DEFAULT)"
[02095ae]219 @echo
220 @echo "Download-List Targets"
[4fc026e]221 @echo " $(FG_GREEN)download-list $(FG_BLUE)$(ARCHS_DLLIST)$(FG_DEFAULT)"
Note: See TracBrowser for help on using the repository browser.