OSDN Git Service

clfs-3.0.0-sysvinit.
[clfsja/cross-lfs-ja.git] / src / Makefile.am
1 ##
2 ## This is part of CLFSja package.
3 ##
4 SUBDIRS=appendices boot bootable chroot cross-tools \
5         final-preps final-system introduction materials network \
6         partitioning prologue schema stylesheets system-config \
7         temp-system testsuite-tools the-end
8 BOOKdir = @abs_bookdir@
9 CHANGE_FILES = \
10         index.ch            \
11         mips-index.ch       \
12         mips64-64-index.ch  \
13         mips64-index.ch     \
14         ppc-index.ch        \
15         ppc64-64-index.ch   \
16         ppc64-index.ch      \
17         sparc-index.ch      \
18         sparc64-64-index.ch \
19         sparc64-index.ch    \
20         x86-index.ch        \
21         x86_64-64-index.ch  \
22         x86_64-index.ch
23 CHANGE_FILES_ENT = \
24         general.ch     \
25         general_ja.ch  \
26         packages.ch    \
27         patches.ch     \
28         users_groups.ch
29
30 EXTRA_DIST = $(CHANGE_FILES) $(CHANGE_FILES_ENT) \
31         tidy.ch userconfig.xml.in
32 srcdir = @srcdir@
33 srcs = $(CHANGE_FILES:.ch=.xml) $(CHANGE_FILES_ENT:.ch=.ent)
34 EXTRACLEANFILES = $(srcs)
35
36 SUFFIXES = .ch .ent .xml
37 .ch.xml:
38         $(top_builddir)/$(CTIE) -m $@ $(BOOKdir)/$@ $(srcdir)/$*.ch >/dev/null
39 .ch.ent:
40         $(top_builddir)/$(CTIE) -m $@ $(BOOKdir)/$@ $(srcdir)/$*.ch >/dev/null
41
42 all: ctie $(srcs) tidy.conf _images _shells html
43
44 ctie:
45         @$(MAKE) -C $(top_builddir)/$@ $@ >/dev/null
46
47 general_ja.ent: $(srcdir)/general_ja.ch
48         cp -p $^ $@
49
50 #_stylesheets:
51 #       $(MKDIR_P) stylesheets
52 #       cp -R $(BOOKdir)/stylesheets/* stylesheets
53 .PHONY: _stylesheets
54 _stylesheets:
55         @$(MAKE) -C stylesheets
56
57 _images:
58         $(MKDIR_P) images
59         cp -R $(BOOKdir)/images/* images
60
61 _shells:
62         cp -p $(BOOKdir)/tidy.sh .
63         cp -p $(BOOKdir)/obfuscate.sh .
64
65 tidy.conf: $(BOOKdir)/tidy.conf $(srcdir)/tidy.ch
66         $(top_builddir)/$(CTIE) -m $@ $^ >/dev/null
67
68 TOP             = $(shell pwd)
69 RENDERDIR       = $(TOP)/../render
70
71 VALIDATEDIR     = $(RENDERDIR)/validate
72 PROFILEDIR      = $(RENDERDIR)/profile
73
74 HTMLDIR         = $(RENDERDIR)/html
75 NOCHUNKDIR      = $(RENDERDIR)/nochunk
76
77 FODIR           = $(RENDERDIR)/fo
78 PDFDIR          = $(RENDERDIR)/pdf
79
80 TROUBLEDIR      = $(RENDERDIR)/trouble
81 DUMPDIR         = $(RENDERDIR)/commands
82 DLLISTDIR       = $(RENDERDIR)/download-list
83
84 CHUNK_QUIET     = 1
85 ROOT_ID         =
86
87 ARCHS           = x86 x86_64 x86_64-64 \
88                    sparc sparc64 sparc64-64 \
89                    mips mips64 mips64-64 \
90                    ppc ppc64 ppc64-64
91
92 #ifdef V
93   Q =
94 #else
95 #  Q = @
96 #endif
97
98 .PHONY: clfs lfs
99 clfs lfs: html
100
101 .PHONY: tidy tidy-f tidy-d
102 #ifeq ($(shell which tidy >/dev/null 2>&1 && echo yes),yes)
103 tidy:
104         @$(MAKE) --no-print-directory tidy-d TIDY_DIR=$(HTMLDIR)
105
106 tidy-f:
107         @echo "Running tidy on F:$(shell basename $(TIDY_FILE))"
108         @$(TOP)/tidy.sh "$(TIDY_FILE)"
109
110 tidy-d:
111         @echo "Running tidy on D:$(shell basename $(TIDY_DIR))"
112         @$(TOP)/tidy.sh "$(TIDY_DIR)"
113 #else
114 #tidy tidy-f tidy-d:
115 #       @echo "Tidy is not installed on this system"
116 #endif
117
118 #.PHONY: titlepage
119 titlepage: _stylesheets
120         @echo "Rendering the top-level index..."
121         $(XSLTPROC) --nonet --output $(HTMLDIR)/index.html \
122           $(TOP)/stylesheets/top-index.xsl \
123           $(TOP)/index.xml
124         @$(MAKE) --no-print-directory tidy-f TIDY_FILE=$(HTMLDIR)/index.html
125
126 ARCHS_VD_XML = $(ARCHS:%=%-validate_dump-xml)
127 .PHONY: $(ARCHS_VD_XML)
128 $(ARCHS_VD_XML): override arch = $(@:%-validate_dump-xml=%)
129 $(ARCHS_VD_XML):
130         @echo "Validating $(arch) book..."
131         $(MKDIR_P) $(VALIDATEDIR)
132         $(Q)xmllint --nonet --noent --xinclude \
133           --relaxng $(TOP)/schema/docbook/4.5/rng/docbook.rng \
134           -o $(VALIDATEDIR)/$(arch)-full.xml \
135           $(TOP)/$(arch)-index.xml
136
137 ARCHS_P_XML = $(ARCHS:%=%-profiled-xml)
138 .PHONY: $(ARCHS_P_XML)
139 $(ARCHS_P_XML): override arch = $(@:%-profiled-xml=%)
140 $(ARCHS_P_XML):
141         @$(MAKE) --no-print-directory $(arch)-validate_dump-xml
142         @echo "Generating profiled $(arch) book..."
143         $(MKDIR_P) $(PROFILEDIR)
144         $(XSLTPROC) --nonet --stringparam profile.condition html \
145           --output $(PROFILEDIR)/$(arch)-html.xml \
146           $(TOP)/stylesheets/lfs-xsl/profile.xsl \
147           $(VALIDATEDIR)/$(arch)-full.xml
148
149 ARCHS_HTML = $(ARCHS:%=%-html)
150 .PHONY: html render $(ARCHS_HTML)
151 html render: $(ARCHS_HTML) titlepage
152 $(ARCHS_HTML): override arch = $(@:%-html=%)
153 $(ARCHS_HTML):
154         @$(MAKE) --no-print-directory $(arch)-profiled-xml
155
156         @echo "Rendering chunked XHTML of $(arch)..."
157         $(MKDIR_P) $(HTMLDIR)/$(arch)
158         $(XSLTPROC) --nonet -stringparam chunk.quietly $(CHUNK_QUIET) \
159           -stringparam rootid "$(ROOT_ID)" \
160           -stringparam base.dir $(HTMLDIR)/$(arch)/ \
161           $(TOP)/stylesheets/clfs-chunked.xsl \
162           $(PROFILEDIR)/$(arch)-html.xml
163
164         @echo "Copying CSS code and images for $(arch)..."
165         $(MKDIR_P) $(HTMLDIR)/$(arch)/stylesheets
166         $(Q)cp $(TOP)/stylesheets/lfs-xsl/*.css $(HTMLDIR)/$(arch)/stylesheets
167         $(Q)sed -i -e "s@../stylesheets@stylesheets@g" $(HTMLDIR)/$(arch)/*.html
168         $(MKDIR_P) -p $(HTMLDIR)/$(arch)/images
169         $(Q)cp $(TOP)/images/*.png $(HTMLDIR)/$(arch)/images
170         $(Q)sed -i -e "s@../images@images@g" $(HTMLDIR)/$(arch)/*.html
171
172         @$(MAKE) --no-print-directory tidy-d TIDY_DIR=$(HTMLDIR)/$(arch)
173
174 ARCHS_NOCHUNKS = $(ARCHS:%=%-nochunks)
175 .PHONY: nochunks $(ARCHS_NOCHUNKS)
176 nochunks: $(ARCHS_NOCHUNKS)
177 $(ARCHS_NOCHUNKS): override arch = $(@:%-nochunks=%)
178 $(ARCHS_NOCHUNKS):
179         @$(MAKE) --no-print-directory $(arch)-profiled-xml
180
181         @echo "Rendering Single File HTML of $(arch)..."
182         $(MKDIR_P) $(NOCHUNKDIR)
183         $(XSLTPROC) --nonet -stringparam rootid "$(ROOT_ID)" \
184           --output $(NOCHUNKDIR)/CLFS-$(arch).html \
185           $(TOP)/stylesheets/clfs-nochunks.xsl \
186           $(PROFILEDIR)/$(arch)-html.xml
187
188         @$(MAKE) --no-print-directory tidy-f TIDY_FILE=$(NOCHUNKDIR)/CLFS-$(arch).html
189
190 ARCHS_FO = $(ARCHS:%=%-fo)
191 .PHONY: fo $(ARCHS_FO)
192 fo: $(ARCHS_FO)
193 $(ARCHS_FO): override arch = $(@:%-fo=%)
194 $(ARCHS_FO):
195         @$(MAKE) --no-print-directory $(arch)-profiled-xml
196
197         @echo "Generating FO file of $(arch)..."
198         $(MKDIR_P) $(FODIR)
199         $(XSLTPROC) --nonet -stringparam rootid "$(ROOT_ID)" \
200           --output $(FODIR)/$(arch).fo \
201           $(TOP)/stylesheets/clfs-pdf.xsl \
202           $(PROFILEDIR)/$(arch)-html.xml
203         $(Q)sed -i -e 's/span="inherit"/span="all"/' $(FODIR)/$(arch).fo
204
205 ARCHS_PDF = $(ARCHS:%=%-pdf)
206 .PHONY: pdf $(ARCHS_PDF)
207 pdf: $(ARCHS_PDF)
208 $(ARCHS_PDF): override arch = $(@:%-pdf=%)
209 $(ARCHS_PDF):
210         @$(MAKE) --no-print-directory $(arch)-fo
211
212         @echo "Rendering PDF of $(arch)..."
213         $(MKDIR_P) $(PDFDIR)
214         $(Q)fop -c userconfig.xml $(FODIR)/$(arch).fo $(PDFDIR)/CLFS-$(arch).pdf
215
216 ARCHS_VALIDATE = $(ARCHS:%=%-validate)
217 .PHONY: validate $(ARCHS_VALIDATE)
218 validate: $(ARCHS_VALIDATE)
219 $(ARCHS_VALIDATE): override arch =  $(@:%-validate=%)
220 $(ARCHS_VALIDATE):
221         @echo "Validating $(arch)..."
222         $(Q)xmllint --xinclude --noout --nonet \
223           --relaxng $(TOP)/schema/docbook/4.5/rng/docbook.rng \
224           $(TOP)/$(arch)-index.xml
225
226 ARCHS_TROUBLE = $(ARCHS:%=%-trouble)
227 .PHONY: trouble $(ARCHS_TROUBLE)
228 trouble: $(ARCHS_TROUBLE)
229 $(ARCHS_TROUBLE): override arch = $(@:%-trouble=%)
230 $(ARCHS_TROUBLE):
231         @echo "Troubleshooting $(arch)..."
232         $(MKDIR_P) $(TROUBLEDIR)
233         $(Q)xmllint --xinclude --nonet \
234           --relaxng $(TOP)/schema/docbook/4.5/rng/docbook.rng \
235           -o $(TROUBLEDIR)/dump-$(arch) \
236           $(TOP)/$(arch)-index.xml
237         $(Q)xmllint --xinclude --noout --nonet \
238           --relaxng $(TOP)/schema/docbook/4.5/rng/docbook.rng \
239           $(TROUBLEDIR)/dump-$(arch)
240         @echo "You can now look at $(TROUBLEDIR)/dump-$(arch) to see the errors"
241
242 ARCHS_DUMP = $(ARCHS:%=%-dump)
243 .PHONY: dump-commands $(ARCHS_DUMP)
244 dump-commands: $(ARCHS_DUMP)
245 $(ARCHS_DUMP): override arch = $(@:%-dump=%)
246 $(ARCHS_DUMP):
247         @echo "Extracting commands from $(arch)..."
248         $(MKDIR_P) $(DUMPDIR)/$(arch)
249         $(XSLTPROC) --xinclude --nonet \
250           --output $(DUMPDIR)/$(arch)/ \
251           $(TOP)/stylesheets/dump-commands.xsl \
252           $(TOP)/$(arch)-index.xml
253
254 ARCHS_DLLIST = $(ARCHS:%=%-dllist)
255 .PHONY: download-list $(ARCHS_DLLIST)
256 download-list: $(ARCHS_DLLIST)
257 $(ARCHS_DLLIST): override arch = $(@:%-dllist=%)
258 $(ARCHS_DLLIST):
259         @echo "Creating download list for $(arch)..."
260         $(MKDIR_P) $(DLLISTDIR)
261         $(XSLTPROC) --xinclude --nonet \
262           --output $(DLLISTDIR)/$(arch).list \
263           $(TOP)/stylesheets/wget.xsl \
264           $(TOP)/$(arch)-index.xml
265
266 FG_GREEN = $(shell echo -e '\e[0;32m')
267 FG_BLUE = $(shell echo -e '\e[0;34m')
268 FG_DEFAULT = $(shell echo -e '\e[0;0m')
269 help:
270         @echo "Output: $(RENDERDIR)"
271         @echo
272         @echo "HTML Targets"
273         @echo "  $(FG_GREEN)clfs lfs tidy html render titlepage $(FG_BLUE)$(ARCHS_HTML)$(FG_DEFAULT)"
274         @echo
275         @echo "NoChunks Targets"
276         @echo "  $(FG_GREEN)nochunks tidy $(FG_BLUE)$(ARCHS_NOCHUNKS)$(FG_DEFAULT)"
277         @echo
278         @echo "FO Targets"
279         @echo "  $(FG_GREEN)fo $(FG_BLUE)$(ARCHS_FO)$(FG_DEFAULT)"
280         @echo
281         @echo "PDF Targets"
282         @echo "  $(FG_GREEN)pdf $(FG_BLUE)$(ARCHS_PDF)$(FG_DEFAULT)"
283         @echo
284         @echo "Validate Targets"
285         @echo "  $(FG_GREEN)validate $(FG_BLUE)$(ARCHS_VALIDATE)$(FG_DEFAULT)"
286         @echo
287         @echo "Trouble Targets"
288         @echo "  $(FG_GREEN)trouble $(FG_BLUE)$(ARCHS_TROUBLE)$(FG_DEFAULT)"
289         @echo
290         @echo "Dump-Commands Targets"
291         @echo "  $(FG_GREEN)dump-commands $(FG_BLUE)$(ARCHS_DUMP)$(FG_DEFAULT)"
292         @echo
293         @echo "Download-List Targets"
294         @echo "  $(FG_GREEN)download-list $(FG_BLUE)$(ARCHS_DLLIST)$(FG_DEFAULT)"