2 ## This is part of LFSbookja package.
4 SUBDIRS=appendices chapter01 chapter02 chapter03 chapter04 chapter05 \
5 chapter06 chapter07 chapter08 chapter09 chapter10 chapter11 \
6 part3intro prologue stylesheets udev-lfs
7 EXTRA_DIST = general.ch index.ch packages.ch patches.ch pdf-fixups.ch \
8 tidy.ch make-aux-files.ch aux-file-data.ch
9 BOOKdir = @abs_bookdir@
11 srcs = general.ent index.xml packages.ent patches.ent pdf-fixups.sh \
12 process-scripts.sh aux-file-data.sh tidy.conf make-aux-files.sh \
13 git-version.sh conditional.ent
14 DISTCLEANFILES = $(srcs)
22 NOCHUNKS_NAME = @NOCHUNKS_NAME@
23 NOCHUNKS_OUTPUT = @NOCHUNKS_OUTPUT@
24 PDF_OUTPUT = @PDF_OUTPUT@
25 URLTOP = http\:\/\/lfsbookja.osdn.jp\/git-ja
27 #ALLXML := $(filter-out $(RENDERTMP)/%, \
28 # $(wildcard ./*.xml ./*/*.xml))
29 ALLXML=$(shell find . -type d -name $(RENDERTMP) -prune -o -type f -name '*.xml' -print)
33 all: ctie $(srcs) stylesheets _bootscripts scripts udev-lfs book
36 @$(MAKE) -C $(top_builddir)/$@ $@ >/dev/null
38 general.ent: $(BOOKdir)/general.ent $(srcdir)/general.ch
39 $(top_builddir)/$(CTIE) -m $@ $^ >/dev/null
40 index.xml: $(BOOKdir)/index.xml $(srcdir)/index.ch
41 $(top_builddir)/$(CTIE) -m $@ $^ >/dev/null
42 packages.ent: $(BOOKdir)/packages.ent $(srcdir)/packages.ch
43 $(top_builddir)/$(CTIE) -m $@ $^ >/dev/null
44 patches.ent: $(BOOKdir)/patches.ent $(srcdir)/patches.ch
45 $(top_builddir)/$(CTIE) -m $@ $^ >/dev/null
46 tidy.conf: $(BOOKdir)/tidy.conf $(srcdir)/tidy.ch
47 $(top_builddir)/$(CTIE) -m $@ $^ >/dev/null
50 scripts: process-scripts.sh aux-file-data.sh make-aux-files.sh pdf-fixups.sh git-version.sh
52 process-scripts.sh: $(BOOKdir)/process-scripts.sh
54 aux-file-data.sh: $(BOOKdir)/aux-file-data.sh $(srcdir)/aux-file-data.ch
55 $(top_builddir)/$(CTIE) -m $@ $^ >/dev/null
57 # sed -i '/.\/make-aux-files.sh/d' $@
58 make-aux-files.sh: $(BOOKdir)/make-aux-files.sh $(srcdir)/make-aux-files.ch
59 $(top_builddir)/$(CTIE) -m $@ $^ >/dev/null
61 pdf-fixups.sh: $(BOOKdir)/pdf-fixups.sh $(srcdir)/pdf-fixups.ch
62 $(top_builddir)/$(CTIE) -m $@ $^ >/dev/null
63 git-version.sh: $(BOOKdir)/git-version.sh
64 sed -e "s|version\.ent|$(abs_builddir)/version\.ent|g" \
65 -e "/^full_date/afull_date=\"\$$year/\$$month_digit/\$$day\"" $^ > $@
66 conditional.ent: $(BOOKdir)/conditional.ent
70 $(MKDIR_P) stylesheets
71 cp -R $(BOOKdir)/stylesheets/* stylesheets
73 _bootscripts: $(ALLXML)
74 $(MKDIR_P) bootscripts
75 cp -pR $(BOOKdir)/bootscripts/* bootscripts
79 # cp -R $(BOOKdir)/udev-lfs/* udev-lfs
81 book: validate profile-html
82 @echo "Generating chunked XHTML files at $(BASEDIR)/ ..."
84 --stringparam chunk.quietly $(CHUNK_QUIET) \
85 --stringparam rootid "$(ROOT_ID)" \
86 --stringparam base.dir $(BASEDIR)/ \
87 stylesheets/lfs-chunked.xsl \
88 $(RENDERTMP)/lfs-html.xml
90 @echo "Copying CSS code and images..."
91 $(MKDIR_P) $(BASEDIR)/stylesheets
92 cp stylesheets/lfs-xsl/*.css $(BASEDIR)/stylesheets
93 sed -i 's|../stylesheet|stylesheet|' $(BASEDIR)/index.html
95 $(MKDIR_P) $(BASEDIR)/images
96 cp -p $(BOOKdir)/images/*.png $(BASEDIR)/images
98 @echo "Running Tidy and obfuscate.sh..."
99 for filename in `find $(BASEDIR) -name "*.html"`; do \
100 $(TIDY) -config tidy.conf $$filename; \
102 ${SHELL} $(BOOKdir)/obfuscate.sh $$filename; \
103 sed -e "s@text/html@application/xhtml+xml@g" \
107 $(MAKE) --no-print-directory $(BASEDIR)/wget-list $(BASEDIR)/md5sums
109 @TXT@nochunks: validate profile-html
110 @TXT@ @echo "Generating non chunked XHTML file..."
111 @TXT@ $(XSLTPROC) --nonet \
112 @TXT@ -stringparam rootid "$(ROOT_ID)" \
113 @TXT@ --output $(BASEDIR)/$(NOCHUNKS_OUTPUT) \
114 @TXT@ stylesheets/lfs-nochunks.xsl \
115 @TXT@ $(RENDERTMP)/lfs-full.xml
116 @TXT@# $(RENDERTMP)/lfs-html2.xml
118 @TXT@ @echo "Running Tidy..."
119 @TXT@ $(TIDY) -config tidy.conf $(BASEDIR)/$(NOCHUNKS_OUTPUT) || true
120 @TXT@ @echo "Running obfuscate.sh..."
121 @TXT@ ${SHELL} $(BOOKdir)/obfuscate.sh $(BASEDIR)/$(NOCHUNKS_OUTPUT)
122 @TXT@ sed -i -e "s@text/html@application/xhtml+xml@g" $(BASEDIR)/$(NOCHUNKS_OUTPUT)
123 @TXT@ sed -i -e "s@../wget-list@wget-list@" $(BASEDIR)/$(NOCHUNKS_OUTPUT)
124 @TXT@ sed -i -e "s@../md5sums@md5sums@" $(BASEDIR)/$(NOCHUNKS_OUTPUT)
125 @TXT@ make $(BASEDIR)/wget-list $(BASEDIR)/md5sums
128 @TXT@ $(LYNX) -assume_charset=utf-8 -display_charset=utf-8 -width=44 -dump $(BASEDIR)/$(NOCHUNKS_OUTPUT) > ../$(NOCHUNKS_NAME).txt
129 @TXT@ sed -i -e "s@file\:///[A-Za-z/\-]+\.html@$(URLTOP)/$(NOCHUNKS_NAME)-nochunks.html@g" \
130 @TXT@ -e "s@file\://$(abs_top_builddir)@$(URLTOP)@g" ../$(NOCHUNKS_NAME).txt
132 @PDF@@TAKAO@pdf: validate userconfig.xml
133 @PDF@@TAKAO@ @echo "Generating profiled XML for PDF..."
134 @PDF@@TAKAO@ $(XSLTPROC) --nonet --stringparam profile.condition pdf \
135 @PDF@@TAKAO@ --output $(RENDERTMP)/lfs-pdf.xml stylesheets/lfs-xsl/profile.xsl \
136 @PDF@@TAKAO@ $(RENDERTMP)/lfs-full.xml
138 @PDF@@TAKAO@ @echo "Generating FO file..."
139 @PDF@@TAKAO@ $(XSLTPROC) --nonet -stringparam rootid "$(ROOT_ID)" \
140 @PDF@@TAKAO@ --output $(RENDERTMP)/lfs-pdf.fo stylesheets/lfs-pdf.xsl \
141 @PDF@@TAKAO@ $(RENDERTMP)/lfs-pdf.xml
142 @PDF@@TAKAO@ sed -i -e 's/span="inherit"/span="all"/' $(RENDERTMP)/lfs-pdf.fo
143 @PDF@@TAKAO@ sed -i -e 's|\.\./wget-list|wget-list|g' -e 's|\.\./md5sums|md5sums|g' $(RENDERTMP)/lfs-pdf.fo
144 @PDF@@TAKAO@ bash pdf-fixups.sh $(RENDERTMP)/lfs-pdf.fo
146 @PDF@@TAKAO@ @echo "Generating PDF file..."
147 @PDF@@TAKAO@ cp -R $(BASEDIR)/images .;
148 @PDF@@TAKAO@ $(FOP) -c userconfig.xml $(RENDERTMP)/lfs-pdf.fo ./$(PDF_OUTPUT)
150 @PDF@@TAKAO@ @echo "Copying images to destination..."
151 @PDF@@TAKAO@ $(Q)mkdir -p $(BASEDIR)/images
152 @PDF@@TAKAO@ $(Q)cp images/*.png $(BASEDIR)/images
154 @PDF@@TAKAO@userconfig.xml: $(srcdir)/userconfig.xml.in
157 @echo "Creating and cleaning $(RENDERTMP)"
158 [ -d $(RENDERTMP) ] || $(MKDIR_P) $(RENDERTMP)
159 rm -f $(RENDERTMP)/lfs-{full,html,pdf}.xml
160 rm -f $(RENDERTMP)/lfs-pdf.fo
162 validate: tmpdir version $(ALLXML)
163 @echo "Processing bootscripts..."
164 bash process-scripts.sh
166 @echo "Adjusting for revision $(REV)..."
167 $(XSLTPROC) --nonet \
169 --output $(RENDERTMP)/lfs-html2.xml \
170 --stringparam profile.revision $(REV) \
171 stylesheets/lfs-xsl/profile.xsl \
174 @echo "Validating the book..."
178 -o $(RENDERTMP)/lfs-full.xml \
179 $(RENDERTMP)/lfs-html2.xml
181 rm -f appendices/*.script
182 ./aux-file-data.sh $(RENDERTMP)/lfs-full.xml $(BOOKdir)
183 @echo "Validation complete."
186 @echo "Making tarballs..."
187 sh make-aux-files.sh $(BOOKdir)
189 profile-html: validate $(ALLXML)
190 @echo "Generating profiled XML for XHTML..."
191 $(XSLTPROC) --nonet --stringparam profile.condition html \
192 --output $(RENDERTMP)/lfs-html.xml stylesheets/lfs-xsl/profile.xsl \
193 $(RENDERTMP)/lfs-full.xml
195 wget-list: $(BASEDIR)/wget-list
196 $(BASEDIR)/wget-list: stylesheets/wget-list.xsl chapter03/chapter03.xml \
197 packages.ent patches.ent general.ent
198 @echo "Generating consolidated wget list at $(BASEDIR)/wget-list ..."
199 $(MKDIR_P) $(BASEDIR)
200 # $(XSLTPROC) --nonet --xinclude \
201 # --stringparam profile.revision $(REV) \
202 # --output $(RENDERTMP)/sysd-wget.xml \
203 # $(BOOKdir)/stylesheets/lfs-xsl/profile.xsl \
204 # ./chapter03/chapter03.xml
205 $(XSLTPROC) --xinclude --nonet \
206 --output $(BASEDIR)/wget-list \
207 $(BOOKdir)/stylesheets/wget-list.xsl \
208 ./chapter03/chapter03.xml
210 md5sums: $(BASEDIR)/md5sums
211 $(BASEDIR)/md5sums: stylesheets/wget-list.xsl chapter03/chapter03.xml packages.ent patches.ent $(srcdir)/general.ch
212 @echo "Generating consolidated md5sum file at $(BASEDIR)/md5sums ..."
213 $(MKDIR_P) $(BASEDIR)
214 $(XSLTPROC) --nonet --xinclude \
215 --stringparam profile.revision $(REV) \
216 --output $(RENDERTMP)/sysv-md5sum.xml \
217 stylesheets/lfs-xsl/profile.xsl \
218 chapter03/chapter03.xml
219 $(XSLTPROC) --xinclude --nonet \
220 --output $(BASEDIR)/md5sums \
221 stylesheets/md5sum.xsl \
222 $(RENDERTMP)/sysv-md5sum.xml
224 "s/BOOTSCRIPTS-MD5SUM/$(shell md5sum lfs-bootscripts*.tar.xz | cut -d' ' -f1)/" \
228 (cd $(BOOKdir) && sh $(abs_builddir)/git-version.sh $(REV))
230 #dump-commands: validate
231 # @echo "Dumping book commands..."
232 # $(XSLTPROC) --output $(DUMPDIR)/ \
233 # stylesheets/dump-commands.xsl $(RENDERTMP)/lfs-full.xml
236 #all: lfs nochunks pdf dump-commands
238 .PHONY : all lfs nochunks pdf profile-html tmpdir validate md5sums wget-list version