1 | BASEDIR=~/lfs-book
|
---|
2 | CHUNK_QUIET=0
|
---|
3 | PDF_OUTPUT=LFS-BOOK-$(ARCH).pdf
|
---|
4 | NOCHUNKS_OUTPUT=LFS-BOOK-$(ARCH).html
|
---|
5 | XSLROOTDIR=/usr/share/xml/docbook/xsl-stylesheets-current
|
---|
6 | ARCH=x86
|
---|
7 |
|
---|
8 | lfs:
|
---|
9 | # top-level index.html
|
---|
10 | xsltproc --nonet --output $(BASEDIR)/index.html stylesheets/top-index.xsl prologue/bookinfo.xml
|
---|
11 |
|
---|
12 | # x86
|
---|
13 | xsltproc --xinclude --nonet -stringparam profile.condition html -stringparam profile.arch x86 \
|
---|
14 | -stringparam chunk.quietly $(CHUNK_QUIET) -stringparam base.dir $(BASEDIR)/x86/ \
|
---|
15 | stylesheets/lfs-chunked.xsl index.xml
|
---|
16 |
|
---|
17 | if [ ! -e $(BASEDIR)/x86/stylesheets ]; then \
|
---|
18 | mkdir -p $(BASEDIR)/x86/stylesheets; \
|
---|
19 | fi;
|
---|
20 | cp stylesheets/*.css $(BASEDIR)/x86/stylesheets
|
---|
21 |
|
---|
22 | if [ ! -e $(BASEDIR)/x86/images ]; then \
|
---|
23 | mkdir -p $(BASEDIR)/x86/images; \
|
---|
24 | fi;
|
---|
25 | cp $(XSLROOTDIR)/images/*.png \
|
---|
26 | $(BASEDIR)/x86/images
|
---|
27 | cd $(BASEDIR)/x86/; sed -i -e "s@../stylesheets@stylesheets@g" \
|
---|
28 | *.html
|
---|
29 | cd $(BASEDIR)/x86/; sed -i -e "s@../images@images@g" \
|
---|
30 | *.html
|
---|
31 |
|
---|
32 | # alpha
|
---|
33 | xsltproc --xinclude --nonet -stringparam profile.condition html -stringparam profile.arch alpha \
|
---|
34 | -stringparam chunk.quietly $(CHUNK_QUIET) -stringparam base.dir $(BASEDIR)/alpha/ \
|
---|
35 | stylesheets/lfs-chunked.xsl index.xml
|
---|
36 |
|
---|
37 | if [ ! -e $(BASEDIR)/alpha/stylesheets ]; then \
|
---|
38 | mkdir -p $(BASEDIR)/alpha/stylesheets; \
|
---|
39 | fi;
|
---|
40 | cp stylesheets/*.css $(BASEDIR)/alpha/stylesheets
|
---|
41 |
|
---|
42 | if [ ! -e $(BASEDIR)/alpha/images ]; then \
|
---|
43 | mkdir -p $(BASEDIR)/alpha/images; \
|
---|
44 | fi;
|
---|
45 | cp $(XSLROOTDIR)/images/*.png \
|
---|
46 | $(BASEDIR)/alpha/images
|
---|
47 | cd $(BASEDIR)/alpha/; sed -i -e "s@../stylesheets@stylesheets@g" \
|
---|
48 | *.html
|
---|
49 | cd $(BASEDIR)/alpha/; sed -i -e "s@../images@images@g" \
|
---|
50 | *.html
|
---|
51 |
|
---|
52 | # ppc
|
---|
53 | xsltproc --xinclude --nonet -stringparam profile.condition html -stringparam profile.arch ppc \
|
---|
54 | -stringparam chunk.quietly $(CHUNK_QUIET) -stringparam base.dir $(BASEDIR)/ppc/ \
|
---|
55 | stylesheets/lfs-chunked.xsl index.xml
|
---|
56 |
|
---|
57 | if [ ! -e $(BASEDIR)/ppc/stylesheets ]; then \
|
---|
58 | mkdir -p $(BASEDIR)/ppc/stylesheets; \
|
---|
59 | fi;
|
---|
60 | cp stylesheets/*.css $(BASEDIR)/ppc/stylesheets
|
---|
61 |
|
---|
62 | if [ ! -e $(BASEDIR)/ppc/images ]; then \
|
---|
63 | mkdir -p $(BASEDIR)/ppc/images; \
|
---|
64 | fi;
|
---|
65 | cp $(XSLROOTDIR)/images/*.png \
|
---|
66 | $(BASEDIR)/ppc/images
|
---|
67 | cd $(BASEDIR)/ppc/; sed -i -e "s@../stylesheets@stylesheets@g" \
|
---|
68 | *.html
|
---|
69 | cd $(BASEDIR)/ppc/; sed -i -e "s@../images@images@g" \
|
---|
70 | *.html
|
---|
71 |
|
---|
72 | # raq2
|
---|
73 | xsltproc --xinclude --nonet -stringparam profile.condition html -stringparam profile.arch raq2 \
|
---|
74 | -stringparam chunk.quietly $(CHUNK_QUIET) -stringparam base.dir $(BASEDIR)/raq2/ \
|
---|
75 | stylesheets/lfs-chunked.xsl index.xml
|
---|
76 |
|
---|
77 | if [ ! -e $(BASEDIR)/raq2/stylesheets ]; then \
|
---|
78 | mkdir -p $(BASEDIR)/raq2/stylesheets; \
|
---|
79 | fi;
|
---|
80 | cp stylesheets/*.css $(BASEDIR)/raq2/stylesheets
|
---|
81 |
|
---|
82 | if [ ! -e $(BASEDIR)/raq2/images ]; then \
|
---|
83 | mkdir -p $(BASEDIR)/raq2/images; \
|
---|
84 | fi;
|
---|
85 | cp $(XSLROOTDIR)/images/*.png \
|
---|
86 | $(BASEDIR)/raq2/images
|
---|
87 | cd $(BASEDIR)/raq2/; sed -i -e "s@../stylesheets@stylesheets@g" \
|
---|
88 | *.html
|
---|
89 | cd $(BASEDIR)/raq2/; sed -i -e "s@../images@images@g" \
|
---|
90 | *.html
|
---|
91 |
|
---|
92 | # common stuff
|
---|
93 | for filename in `find $(BASEDIR) -name "*.html"`; do \
|
---|
94 | tidy -config tidy.conf $$filename; \
|
---|
95 | true; \
|
---|
96 | done;
|
---|
97 |
|
---|
98 | for filename in `find $(BASEDIR) -name "*.html"`; do \
|
---|
99 | sed -i -e "s@text/html@application/xhtml+xml@g" $$filename; \
|
---|
100 | done;
|
---|
101 |
|
---|
102 | html:
|
---|
103 | xsltproc --xinclude --nonet -stringparam profile.condition html -stringparam profile.arch $(ARCH) \
|
---|
104 | -stringparam chunk.quietly $(CHUNK_QUIET) -stringparam base.dir $(BASEDIR)/$(ARCH)/ \
|
---|
105 | stylesheets/lfs-chunked.xsl index.xml
|
---|
106 |
|
---|
107 | if [ ! -e $(BASEDIR)/$(ARCH)/stylesheets ]; then \
|
---|
108 | mkdir -p $(BASEDIR)/$(ARCH)/stylesheets; \
|
---|
109 | fi;
|
---|
110 | cp stylesheets/*.css $(BASEDIR)/$(ARCH)/stylesheets
|
---|
111 |
|
---|
112 | if [ ! -e $(BASEDIR)/$(ARCH)/images ]; then \
|
---|
113 | mkdir -p $(BASEDIR)/$(ARCH)/images; \
|
---|
114 | fi;
|
---|
115 | cp $(XSLROOTDIR)/images/*.png \
|
---|
116 | $(BASEDIR)/$(ARCH)/images
|
---|
117 | cd $(BASEDIR)/$(ARCH)/; sed -i -e "s@../stylesheets@stylesheets@g" \
|
---|
118 | *.html
|
---|
119 | cd $(BASEDIR)/$(ARCH)/; sed -i -e "s@../images@images@g" \
|
---|
120 | *.html
|
---|
121 |
|
---|
122 | for filename in `find $(BASEDIR)/$(ARCH) -name "*.html"`; do \
|
---|
123 | tidy -config tidy.conf $$filename; \
|
---|
124 | true; \
|
---|
125 | done;
|
---|
126 |
|
---|
127 | for filename in `find $(BASEDIR)/$(ARCH)/ -name "*.html"`; do \
|
---|
128 | sed -i -e "s@text/html@application/xhtml+xml@g" $$filename; \
|
---|
129 | done;
|
---|
130 |
|
---|
131 | pdf:
|
---|
132 | xsltproc --xinclude --nonet --stringparam profile.condition pdf -stringparam profile.arch $(ARCH) \
|
---|
133 | --output $(BASEDIR)/lfs-pdf.xml stylesheets/lfs-profile.xsl index.xml
|
---|
134 |
|
---|
135 | xsltproc --nonet --output $(BASEDIR)/lfs-pdf.fo stylesheets/lfs-pdf.xsl \
|
---|
136 | $(BASEDIR)/lfs-pdf.xml
|
---|
137 |
|
---|
138 | sed -i -e "s/inherit/all/" $(BASEDIR)/lfs-pdf.fo
|
---|
139 |
|
---|
140 | fop.sh $(BASEDIR)/lfs-pdf.fo $(BASEDIR)/$(PDF_OUTPUT)
|
---|
141 |
|
---|
142 | rm $(BASEDIR)/lfs-pdf.xml $(BASEDIR)/lfs-pdf.fo
|
---|
143 |
|
---|
144 | nochunks:
|
---|
145 | xsltproc --xinclude --nonet -stringparam profile.condition html -stringparam profile.arch $(ARCH) \
|
---|
146 | --output $(BASEDIR)/$(NOCHUNKS_OUTPUT) stylesheets/lfs-nochunks.xsl index.xml
|
---|
147 |
|
---|
148 | tidy -config tidy.conf $(BASEDIR)/$(NOCHUNKS_OUTPUT) || true
|
---|
149 |
|
---|
150 | sed -i -e "s@text/html@application/xhtml+xml@g" \
|
---|
151 | $(BASEDIR)/$(NOCHUNKS_OUTPUT)
|
---|
152 |
|
---|
153 | validate:
|
---|
154 | # x86
|
---|
155 | xsltproc --xinclude --nonet -stringparam profile.arch x86 \
|
---|
156 | --output index-x86.xml stylesheets/lfs-profile.xsl index.xml
|
---|
157 | xmllint --noout --nonet --postvalid index-x86.xml
|
---|
158 |
|
---|
159 | # alpha
|
---|
160 | xsltproc --xinclude --nonet -stringparam profile.arch alpha \
|
---|
161 | --output index-alpha.xml stylesheets/lfs-profile.xsl index.xml
|
---|
162 | xmllint --noout --nonet --postvalid index-alpha.xml
|
---|
163 |
|
---|
164 | # ppc
|
---|
165 | xsltproc --xinclude --nonet -stringparam profile.arch ppc \
|
---|
166 | --output index-ppc.xml stylesheets/lfs-profile.xsl index.xml
|
---|
167 | xmllint --noout --nonet --postvalid index-ppc.xml
|
---|
168 |
|
---|
169 | # raq2
|
---|
170 | xsltproc --xinclude --nonet -stringparam profile.arch raq2 \
|
---|
171 | --output index-raq2.xml stylesheets/lfs-profile.xsl index.xml
|
---|
172 | xmllint --noout --nonet --postvalid index-raq2.xml
|
---|
173 |
|
---|
174 | # clean-up
|
---|
175 | rm index-x86.xml index-alpha.xml index-ppc.xml index-raq2.xml
|
---|
176 |
|
---|