1 | BASEDIR=~/lfs-book
|
---|
2 | CHUNK_QUIET=0
|
---|
3 | PDF_OUTPUT=LFS-BOOK.pdf
|
---|
4 | NOCHUNKS_OUTPUT=LFS-BOOK.html
|
---|
5 | XSLROOTDIR=/usr/share/xml/docbook/xsl-stylesheets-current
|
---|
6 |
|
---|
7 | lfs:
|
---|
8 | xsltproc --xinclude --nonet -stringparam profile.condition html \
|
---|
9 | -stringparam chunk.quietly $(CHUNK_QUIET) -stringparam base.dir $(BASEDIR)/ \
|
---|
10 | stylesheets/lfs-chunked.xsl index.xml
|
---|
11 |
|
---|
12 | if [ ! -e $(BASEDIR)/stylesheets ]; then \
|
---|
13 | mkdir -p $(BASEDIR)/stylesheets; \
|
---|
14 | fi;
|
---|
15 | cp stylesheets/*.css $(BASEDIR)/stylesheets
|
---|
16 |
|
---|
17 | if [ ! -e $(BASEDIR)/images ]; then \
|
---|
18 | mkdir -p $(BASEDIR)/images; \
|
---|
19 | fi;
|
---|
20 | cp $(XSLROOTDIR)/images/*.png \
|
---|
21 | $(BASEDIR)/images
|
---|
22 | cd $(BASEDIR)/; sed -i -e "s@../stylesheets@stylesheets@g" \
|
---|
23 | *.html
|
---|
24 | cd $(BASEDIR)/; sed -i -e "s@../images@images@g" \
|
---|
25 | *.html
|
---|
26 |
|
---|
27 | for filename in `find $(BASEDIR) -name "*.html"`; do \
|
---|
28 | tidy -config tidy.conf $$filename; \
|
---|
29 | true; \
|
---|
30 | done;
|
---|
31 |
|
---|
32 | for filename in `find $(BASEDIR) -name "*.html"`; do \
|
---|
33 | sed -i -e "s@text/html@application/xhtml+xml@g" $$filename; \
|
---|
34 | done;
|
---|
35 |
|
---|
36 | # Uncomment this for testing and stable versions
|
---|
37 | pdf:
|
---|
38 | xsltproc --xinclude --nonet --stringparam profile.condition pdf \
|
---|
39 | --output $(BASEDIR)/lfs-pdf.xml stylesheets/lfs-profile.xsl index.xml
|
---|
40 | xsltproc --nonet --output $(BASEDIR)/lfs-pdf.fo stylesheets/lfs-pdf.xsl \
|
---|
41 | $(BASEDIR)/lfs-pdf.xml
|
---|
42 | sed -i -e "s/inherit/all/" $(BASEDIR)/lfs-pdf.fo
|
---|
43 | fop.sh $(BASEDIR)/lfs-pdf.fo $(BASEDIR)/$(PDF_OUTPUT)
|
---|
44 | rm $(BASEDIR)/lfs-pdf.xml $(BASEDIR)/lfs-pdf.fo
|
---|
45 |
|
---|
46 | nochunks:
|
---|
47 | xsltproc --xinclude --nonet -stringparam profile.condition html \
|
---|
48 | --output $(BASEDIR)/$(NOCHUNKS_OUTPUT) \
|
---|
49 | stylesheets/lfs-nochunks.xsl index.xml
|
---|
50 |
|
---|
51 | tidy -config tidy.conf $(BASEDIR)/$(NOCHUNKS_OUTPUT) || true
|
---|
52 |
|
---|
53 | sed -i -e "s@text/html@application/xhtml+xml@g" \
|
---|
54 | $(BASEDIR)/$(NOCHUNKS_OUTPUT)
|
---|
55 |
|
---|
56 | if [ ! -e $(BASEDIR)/images ]; then \
|
---|
57 | mkdir -p $(BASEDIR)/images; \
|
---|
58 | fi;
|
---|
59 | cp $(XSLROOTDIR)/images/*.png \
|
---|
60 | $(BASEDIR)/images
|
---|
61 | cd $(BASEDIR)/; sed -i -e "s@../images@images@g" \
|
---|
62 | *.html
|
---|
63 |
|
---|
64 | validate:
|
---|
65 | xmllint --noout --nonet --xinclude --postvalid index.xml
|
---|
66 |
|
---|