2 RENDERTMP
= $(HOME
)/tmp
18 ifneq ($(REV
), systemd
)
19 $(error REV must be
'sysv' (default
) or
'systemd'.
)
24 BASEDIR ?
= $(HOME
)/public_html
/lfs-book
25 PDF_OUTPUT ?
= LFS-BOOK.pdf
26 NOCHUNKS_OUTPUT ?
= LFS-BOOK.html
27 DUMPDIR ?
= $(HOME
)/lfs-commands
29 BASEDIR ?
= $(HOME
)/public_html
/lfs-systemd
30 PDF_OUTPUT ?
= LFS-SYSD-BOOK.pdf
31 NOCHUNKS_OUTPUT ?
= LFS-SYSD-BOOK.html
32 DUMPDIR ?
= $(HOME
)/lfs-sysd-commands
35 book
: validate profile-html
36 @echo
"Generating chunked XHTML files at $(BASEDIR)/ ..."
37 $(Q
)xsltproc
--nonet \
38 --stringparam chunk.quietly
$(CHUNK_QUIET
) \
39 --stringparam rootid
"$(ROOT_ID)" \
40 --stringparam base.
dir $(BASEDIR
)/ \
41 stylesheets
/lfs-chunked.xsl \
42 $(RENDERTMP
)/lfs-html.xml
44 @echo
"Copying CSS code and images..."
45 $(Q
)mkdir
-p
$(BASEDIR
)/stylesheets
46 $(Q
)cp stylesheets
/lfs-xsl
/*.css
$(BASEDIR
)/stylesheets
47 $(Q
)sed
-e
's|../stylesheet|stylesheet|' \
48 -i
$(BASEDIR
)/index.html
50 $(Q
)mkdir
-p
$(BASEDIR
)/images
51 $(Q
)cp images
/*.png
$(BASEDIR
)/images
53 @echo
"Running Tidy and obfuscate.sh..."
54 $(Q
)for filename in
`find $(BASEDIR) -name "*.html"`; do \
55 tidy
-config tidy.conf
$$filename; \
56 /bin
/bash obfuscate.sh
$$filename; \
57 sed
-e
"s|text/html|application/xhtml+xml|g" \
61 $(Q
)$(MAKE
) --no-print-directory wget-list md5sums
64 @echo
"Generating profiled XML for PDF..."
65 $(Q
)xsltproc
--nonet \
66 --stringparam profile.condition pdf \
67 --output
$(RENDERTMP
)/lfs-pdf.xml \
68 stylesheets
/lfs-xsl
/profile.xsl \
69 $(RENDERTMP
)/lfs-full.xml
71 @echo
"Generating FO file..."
72 $(Q
)xsltproc
--nonet \
73 --stringparam rootid
"$(ROOT_ID)" \
74 --output
$(RENDERTMP
)/lfs-pdf.fo \
75 stylesheets
/lfs-pdf.xsl \
76 $(RENDERTMP
)/lfs-pdf.xml
78 $(Q
)sed
-i
-e
's/span="inherit"/span="all"/' $(RENDERTMP
)/lfs-pdf.fo
79 $(Q
)bash pdf-fixups.sh
$(RENDERTMP
)/lfs-pdf.fo
81 @echo
"Generating PDF file..."
82 $(Q
)mkdir
-p
$(RENDERTMP
)/images
83 $(Q
)cp images
/*.png
$(RENDERTMP
)/images
85 $(Q
)mkdir
-p
$(BASEDIR
)
87 $(Q
)fop
-q
$(RENDERTMP
)/lfs-pdf.fo
$(BASEDIR
)/$(PDF_OUTPUT
) 2>fop.log
88 @echo
"$(BASEDIR)/$(PDF_OUTPUT) created"
89 @echo
"fop.log created"
91 nochunks
: validate profile-html
92 @echo
"Generating non chunked XHTML file..."
93 $(Q
)xsltproc
--nonet \
94 --stringparam rootid
"$(ROOT_ID)" \
95 --output
$(BASEDIR
)/$(NOCHUNKS_OUTPUT
) \
96 stylesheets
/lfs-nochunks.xsl \
97 $(RENDERTMP
)/lfs-html.xml
99 @echo
"Running Tidy..."
100 $(Q
)tidy
-config tidy.conf
$(BASEDIR
)/$(NOCHUNKS_OUTPUT
) ||
test $$?
-le
1
102 @echo
"Running obfuscate.sh..."
103 $(Q
)bash obfuscate.sh
$(BASEDIR
)/$(NOCHUNKS_OUTPUT
)
104 $(Q
)sed
-e
"s|text/html|application/xhtml+xml|g" \
105 -e
"s|../wget-list|wget-list|" \
106 -e
"s|../md5sums|md5sums|" \
107 -i
$(BASEDIR
)/$(NOCHUNKS_OUTPUT
)
109 @echo
"Output at $(BASEDIR)/$(NOCHUNKS_OUTPUT)"
112 @echo
"Creating and cleaning $(RENDERTMP)"
113 $(Q
)mkdir
-p
$(RENDERTMP
)
114 $(Q
)rm -f
$(RENDERTMP
)/lfs
*.xml
115 $(Q
)rm -f
$(RENDERTMP
)/*wget
*
116 $(Q
)rm -f
$(RENDERTMP
)/*md5sum
*
117 $(Q
)rm -f
$(RENDERTMP
)/*pdf.fo
119 validate
: tmpdir version
120 @echo
"Processing bootscripts..."
121 $(Q
)bash process-scripts.sh
123 @echo
"Adjusting for revision $(REV)..."
124 $(Q
)xsltproc
--nonet \
126 --stringparam profile.revision
$(REV
) \
127 --output
$(RENDERTMP
)/lfs-html2.xml \
128 stylesheets
/lfs-xsl
/profile.xsl \
131 @echo
"Validating the book..."
132 $(Q
)xmllint
--nonet \
135 --output
$(RENDERTMP
)/lfs-full.xml \
136 $(RENDERTMP
)/lfs-html2.xml
138 $(Q
)rm -f appendices
/*.script
139 $(Q
).
/aux-file-data.sh
$(RENDERTMP
)/lfs-full.xml
140 @echo
"Validation complete."
143 @echo
"Generating profiled XML for XHTML..."
144 $(Q
)xsltproc
--nonet \
145 --stringparam profile.condition html \
146 --output
$(RENDERTMP
)/lfs-html.xml \
147 stylesheets
/lfs-xsl
/profile.xsl \
148 $(RENDERTMP
)/lfs-full.xml
150 DOWNLOADS_DEP
= chapter03
/packages.xml chapter03
/patches.xml \
151 packages.ent patches.ent general.ent
153 wget-list
: $(BASEDIR
)/wget-list
$(BASEDIR
)/wget-list-
$(REV
)
154 $(BASEDIR
)/wget-list
: stylesheets
/wget-list.xsl
$(DOWNLOADS_DEP
)
155 @echo
"Generating consolidated wget list at $(BASEDIR)/wget-list ..."
156 $(Q
)mkdir
-p
$(BASEDIR
)
157 $(Q
)xsltproc
--nonet \
159 --output
$(BASEDIR
)/wget-list \
160 stylesheets
/wget-list.xsl \
161 chapter03
/chapter03.xml
163 $(BASEDIR
)/wget-list-
$(REV
): stylesheets
/wget-list.xsl
$(DOWNLOADS_DEP
)
164 $(Q
)xsltproc
--nonet \
166 --stringparam profile.revision
$(REV
) \
167 --output
$(RENDERTMP
)/wget-list.xml \
168 stylesheets
/lfs-xsl
/profile.xsl \
169 chapter03
/chapter03.xml
171 $(Q
)xsltproc
--nonet \
172 --output
$(BASEDIR
)/wget-list-
$(REV
) \
173 stylesheets
/wget-list.xsl \
174 $(RENDERTMP
)/wget-list.xml
176 md5sums
: $(BASEDIR
)/md5sums
177 $(BASEDIR
)/md5sums
: stylesheets
/wget-list.xsl
$(DOWNLOADS_DEP
)
178 @echo
"Generating consolidated md5sum file at $(BASEDIR)/md5sums ..."
179 $(Q
)mkdir
-p
$(BASEDIR
)
181 $(Q
)xsltproc
--nonet \
183 --stringparam profile.revision
$(REV
) \
184 --output
$(RENDERTMP
)/md5sum.xml \
185 stylesheets
/lfs-xsl
/profile.xsl \
186 chapter03
/chapter03.xml
188 $(Q
)xsltproc
--nonet \
189 --output
$(BASEDIR
)/md5sums \
190 stylesheets
/md5sum.xsl \
191 $(RENDERTMP
)/md5sum.xml
193 "s/BOOTSCRIPTS-MD5SUM/$(shell md5sum lfs-bootscripts*.tar.xz | cut -d' ' -f1)/" \
197 $(Q
).
/git-version.sh
$(REV
)
199 dump-commands
: validate
200 @echo
"Dumping book commands..."
202 $(Q
)rm -rf
$(DUMPDIR
)
204 $(Q
)xsltproc
--output
$(DUMPDIR
)/ \
205 stylesheets
/dump-commands.xsl \
206 $(RENDERTMP
)/lfs-full.xml
207 @echo
"Dumping book commands complete in $(DUMPDIR)"
209 all: book nochunks pdf dump-commands
212 $(Q
)DIST
=/tmp
/LFS-RELEASE .
/git-version.sh
$(REV
)
213 $(Q
)rm -f lfs-
$$(</tmp
/LFS-RELEASE
).
tar.xz
214 $(Q
)tar cJf lfs-
$$(</tmp
/LFS-RELEASE
).
tar.xz \
215 $(shell git ls-tree HEAD .
--name-only
) version.ent \
216 -C
/tmp LFS-RELEASE \
217 --transform
"s,^,lfs-$$(</tmp/LFS-RELEASE)/,"
218 $(Q
)echo
"Generated XML tarball lfs-$$(</tmp/LFS-RELEASE).tar.xz"
220 .PHONY
: all book dump-commands nochunks pdf profile-html tmpdir validate md5sums wget-list version
dist