source: clfs-embedded/BOOK/Makefile@ c01e552

Last change on this file since c01e552 was b1d44e4, checked in by Andrew Bradford <andrew@…>, 11 years ago

Makefile: Remove wrt

So that wrt book won't be built.

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