source: clfs-embedded/BOOK/Makefile@ 62a8529

Last change on this file since 62a8529 was a94e338, 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
Line 
1TOP := $(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 mips wrt arm
21
22ifdef V
23 Q =
24else
25 Q = @
26endif
27
28.PHONY: clfs lfs
29clfs lfs: html
30
31.PHONY: tidy tidy-f tidy-d
32ifeq ($(shell which tidy >/dev/null 2>&1 && echo yes),yes)
33tidy:
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)"
43else
44tidy tidy-f tidy-d:
45 @echo "Tidy is not installed on this system"
46endif
47
48.PHONY: titlepage
49titlepage:
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)
62 $(Q)xmllint --nonet --noent --xinclude --postvalid \
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)
73 $(Q)xsltproc --nonet --stringparam profile.condition html \
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
84
85 @echo "Rendering chunked XHTML of $(arch)..."
86 $(Q)mkdir -p $(HTMLDIR)/$(arch)
87 $(Q)xsltproc --nonet -stringparam chunk.quietly $(CHUNK_QUIET) \
88 -stringparam rootid "$(ROOT_ID)" \
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=%)
107$(ARCHS_NOCHUNKS):
108 @$(MAKE) --no-print-directory $(arch)-profiled-xml
109
110 @echo "Rendering Single File HTML of $(arch)..."
111 $(Q)mkdir -p $(NOCHUNKDIR)
112 $(Q)xsltproc --nonet -stringparam rootid "$(ROOT_ID)" \
113 --output $(NOCHUNKDIR)/CLFS-$(arch).html \
114 $(PWD)/stylesheets/clfs-nochunks.xsl \
115 $(PROFILEDIR)/$(arch)-html.xml
116
117 @$(MAKE) --no-print-directory tidy-f TIDY_FILE=$(NOCHUNKDIR)/CLFS-$(arch).html
118
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
125
126 @echo "Generating FO file of $(arch)..."
127 @mkdir -p $(FODIR)
128 $(Q)xsltproc --nonet -stringparam rootid "$(ROOT_ID)" \
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
140
141 @echo "Rendering PDF of $(arch)..."
142 $(Q)mkdir -p $(PDFDIR)
143 $(Q)fop $(FODIR)/$(arch).fo $(PDFDIR)/CLFS-$(arch).pdf
144
145ARCHS_VALIDATE := $(ARCHS:%=%-validate)
146.PHONY: validate $(ARCHS_VALIDATE)
147validate: $(ARCHS_VALIDATE)
148$(ARCHS_VALIDATE): override arch = $(@:%-validate=%)
149$(ARCHS_VALIDATE):
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=%)
159$(ARCHS_TROUBLE):
160 @echo "Troubleshooting $(arch)..."
161 @mkdir -p $(TROUBLEDIR)
162 $(Q)xmllint --xinclude --nonet --postvalid \
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)
171dump-commands: $(ARCHS_DUMP)
172$(ARCHS_DUMP): override arch = $(@:%-dump=%)
173$(ARCHS_DUMP):
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)
183download-list: $(ARCHS_DLLIST)
184$(ARCHS_DLLIST): override arch = $(@:%-dllist=%)
185$(ARCHS_DLLIST):
186 @echo "Creating download list for $(arch)..."
187 $(Q)mkdir -p $(DLLISTDIR)
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')
196help:
197 @echo "Output: $(RENDERDIR)"
198 @echo
199 @echo "HTML Targets"
200 @echo " $(FG_GREEN)clfs lfs tidy html render titlepage $(FG_BLUE)$(ARCHS_HTML)$(FG_DEFAULT)"
201 @echo
202 @echo "NoChunks Targets"
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)"
207 @echo
208 @echo "PDF Targets"
209 @echo " $(FG_GREEN)pdf $(FG_BLUE)$(ARCHS_PDF)$(FG_DEFAULT)"
210 @echo
211 @echo "Validate Targets"
212 @echo " $(FG_GREEN)validate $(FG_BLUE)$(ARCHS_VALIDATE)$(FG_DEFAULT)"
213 @echo
214 @echo "Trouble Targets"
215 @echo " $(FG_GREEN)trouble $(FG_BLUE)$(ARCHS_TROUBLE)$(FG_DEFAULT)"
216 @echo
217 @echo "Dump-Commands Targets"
218 @echo " $(FG_GREEN)dump-commands $(FG_BLUE)$(ARCHS_DUMP)$(FG_DEFAULT)"
219 @echo
220 @echo "Download-List Targets"
221 @echo " $(FG_GREEN)download-list $(FG_BLUE)$(ARCHS_DLLIST)$(FG_DEFAULT)"
Note: See TracBrowser for help on using the repository browser.