[edb9842] | 1 | BASEDIR=~/lfs-book
|
---|
[2c5e4d5] | 2 | DUMPDIR=~/lfs-commands
|
---|
[0e6d3c0] | 3 | CHUNK_QUIET=1
|
---|
| 4 | ROOT_ID=""
|
---|
[44758be] | 5 | PDF_OUTPUT=LFS-BOOK.pdf
|
---|
| 6 | NOCHUNKS_OUTPUT=LFS-BOOK.html
|
---|
[3a4594b] | 7 |
|
---|
[05d60ce] | 8 | ifdef V
|
---|
| 9 | Q =
|
---|
| 10 | else
|
---|
| 11 | Q = @
|
---|
| 12 | endif
|
---|
| 13 |
|
---|
[0e6d3c0] | 14 | lfs: validxml profile-html
|
---|
| 15 | @echo "Generating chunked XHTML files..."
|
---|
[05d60ce] | 16 | $(Q)xsltproc --nonet -stringparam chunk.quietly $(CHUNK_QUIET) \
|
---|
[0e6d3c0] | 17 | -stringparam rootid $(ROOT_ID) -stringparam base.dir $(BASEDIR)/ \
|
---|
| 18 | stylesheets/lfs-chunked.xsl /tmp/lfs-html.xml
|
---|
[287ea55] | 19 |
|
---|
[0e6d3c0] | 20 | @echo "Copying CSS code and images..."
|
---|
[05d60ce] | 21 | $(Q)if [ ! -e $(BASEDIR)/stylesheets ]; then \
|
---|
[44758be] | 22 | mkdir -p $(BASEDIR)/stylesheets; \
|
---|
| 23 | fi;
|
---|
[05d60ce] | 24 | $(Q)cp stylesheets/lfs-xsl/*.css $(BASEDIR)/stylesheets
|
---|
| 25 | $(Q)if [ ! -e $(BASEDIR)/images ]; then \
|
---|
[44758be] | 26 | mkdir -p $(BASEDIR)/images; \
|
---|
| 27 | fi;
|
---|
[05d60ce] | 28 | $(Q)cp images/*.png $(BASEDIR)/images
|
---|
| 29 | $(Q)cd $(BASEDIR)/; sed -i -e "s@../stylesheets@stylesheets@g" *.html
|
---|
| 30 | $(Q)cd $(BASEDIR)/; sed -i -e "s@../images@images@g" *.html
|
---|
[287ea55] | 31 |
|
---|
[05d60ce] | 32 | @echo "Running Tidy and obfuscate.sh..."
|
---|
| 33 | $(Q)for filename in `find $(BASEDIR) -name "*.html"`; do \
|
---|
[132fd16] | 34 | tidy -config tidy.conf $$filename; \
|
---|
| 35 | true; \
|
---|
| 36 | sh obfuscate.sh $$filename; \
|
---|
[3879ebc] | 37 | sed -i -e "s@text/html@application/xhtml+xml@g" $$filename; \
|
---|
| 38 | done;
|
---|
[5470c67] | 39 |
|
---|
[05d60ce] | 40 | $(Q)$(MAKE) wget-list
|
---|
[3a4594b] | 41 |
|
---|
[0e6d3c0] | 42 | pdf: validxml
|
---|
| 43 | @echo "Generating profiled XML for PDF..."
|
---|
[05d60ce] | 44 | $(Q)xsltproc --nonet --stringparam profile.condition pdf \
|
---|
[0e6d3c0] | 45 | --output /tmp/lfs-pdf.xml stylesheets/lfs-xsl/profile.xsl \
|
---|
| 46 | /tmp/lfs-full.xml
|
---|
| 47 |
|
---|
| 48 | @echo "Generating FO file..."
|
---|
[05d60ce] | 49 | $(Q)xsltproc --nonet -stringparam rootid $(ROOT_ID) \
|
---|
[0e6d3c0] | 50 | --output /tmp//lfs-pdf.fo stylesheets/lfs-pdf.xsl /tmp/lfs-pdf.xml
|
---|
[05d60ce] | 51 | $(Q)sed -i -e 's/span="inherit"/span="all"/' /tmp/lfs-pdf.fo
|
---|
[0e6d3c0] | 52 |
|
---|
| 53 | @echo "Generating PDF file..."
|
---|
[c948b40] | 54 | $(Q)if [ ! -e $(BASEDIR) ]; then \
|
---|
| 55 | mkdir -p $(BASEDIR); \
|
---|
| 56 | fi;
|
---|
[05d60ce] | 57 | $(Q)fop /tmp/lfs-pdf.fo $(BASEDIR)/$(PDF_OUTPUT)
|
---|
[0e6d3c0] | 58 |
|
---|
| 59 | nochunks: validxml profile-html
|
---|
| 60 | @echo "Generating non chunked XHTML file..."
|
---|
[0b158f3] | 61 | $(Q)xsltproc --nonet -stringparam rootid $(ROOT_ID) \
|
---|
| 62 | --output $(BASEDIR)/$(NOCHUNKS_OUTPUT) \
|
---|
[0e6d3c0] | 63 | stylesheets/lfs-nochunks.xsl /tmp/lfs-html.xml
|
---|
| 64 |
|
---|
| 65 | @echo "Running Tidy..."
|
---|
[05d60ce] | 66 | $(Q)tidy -config tidy.conf $(BASEDIR)/$(NOCHUNKS_OUTPUT) || true
|
---|
| 67 | @echo "Running obfuscate.sh..."
|
---|
| 68 | $(Q)sh obfuscate.sh $(BASEDIR)/$(NOCHUNKS_OUTPUT)
|
---|
| 69 | $(Q)sed -i -e "s@text/html@application/xhtml+xml@g" \
|
---|
[81fd230] | 70 | $(BASEDIR)/$(NOCHUNKS_OUTPUT)
|
---|
| 71 |
|
---|
[0e6d3c0] | 72 | validxml:
|
---|
| 73 | @echo "Validating the book..."
|
---|
[05d60ce] | 74 | $(Q)xmllint --nonet --noent --xinclude --postvalid \
|
---|
[0e6d3c0] | 75 | -o /tmp/lfs-full.xml index.xml
|
---|
| 76 |
|
---|
| 77 | profile-html: validxml
|
---|
| 78 | @echo "Generating profiled XML for XHTML..."
|
---|
[05d60ce] | 79 | $(Q)xsltproc --nonet --stringparam profile.condition html \
|
---|
[0e6d3c0] | 80 | --output /tmp/lfs-html.xml stylesheets/lfs-xsl/profile.xsl \
|
---|
| 81 | /tmp/lfs-full.xml
|
---|
| 82 |
|
---|
| 83 | wget-list:
|
---|
| 84 | @echo "Generating wget list..."
|
---|
[05d60ce] | 85 | $(Q)mkdir -p $(BASEDIR)
|
---|
| 86 | $(Q)xsltproc --xinclude --nonet --output $(BASEDIR)/wget-list \
|
---|
[0e6d3c0] | 87 | stylesheets/wget-list.xsl chapter03/chapter03.xml
|
---|
| 88 |
|
---|
[05d60ce] | 89 | dump-commands: validxml
|
---|
[0e6d3c0] | 90 | @echo "Dumping book commands..."
|
---|
[05d60ce] | 91 | $(Q)xsltproc --output $(DUMPDIR)/ \
|
---|
| 92 | stylesheets/dump-commands.xsl /tmp/lfs-full.xml
|
---|
[2c5e4d5] | 93 |
|
---|
[287ea55] | 94 | validate:
|
---|
[0e6d3c0] | 95 | @echo "Validating the book..."
|
---|
[05d60ce] | 96 | $(Q)xmllint --noout --nonet --xinclude --postvalid index.xml
|
---|
[0e6d3c0] | 97 |
|
---|
| 98 | all: lfs nochunks pdf dump-commands
|
---|
[536b6aa] | 99 |
|
---|
[0e6d3c0] | 100 | .PHONY : all dump-commands lfs nochunks pdf profile-html validate validxml wget-list
|
---|