[7d39455] | 1 | BASEDIR = ~/lfs-book
|
---|
| 2 | DUMPDIR = ~/lfs-commands
|
---|
| 3 | RENDERTMP = $(HOME)/tmp
|
---|
| 4 | CHUNK_QUIET = 1
|
---|
| 5 | ROOT_ID =
|
---|
| 6 | PDF_OUTPUT = LFS-BOOK.pdf
|
---|
| 7 | NOCHUNKS_OUTPUT = LFS-BOOK.html
|
---|
[3a4594b] | 8 |
|
---|
[05d60ce] | 9 | ifdef V
|
---|
| 10 | Q =
|
---|
| 11 | else
|
---|
| 12 | Q = @
|
---|
| 13 | endif
|
---|
| 14 |
|
---|
[1c48007] | 15 | lfs: maketar validxml profile-html
|
---|
[0e6d3c0] | 16 | @echo "Generating chunked XHTML files..."
|
---|
[05d60ce] | 17 | $(Q)xsltproc --nonet -stringparam chunk.quietly $(CHUNK_QUIET) \
|
---|
[7d39455] | 18 | -stringparam rootid "$(ROOT_ID)" -stringparam base.dir $(BASEDIR)/ \
|
---|
[106dc42] | 19 | stylesheets/lfs-chunked.xsl $(RENDERTMP)/lfs-html.xml
|
---|
[287ea55] | 20 |
|
---|
[0e6d3c0] | 21 | @echo "Copying CSS code and images..."
|
---|
[05d60ce] | 22 | $(Q)if [ ! -e $(BASEDIR)/stylesheets ]; then \
|
---|
[44758be] | 23 | mkdir -p $(BASEDIR)/stylesheets; \
|
---|
| 24 | fi;
|
---|
[05d60ce] | 25 | $(Q)cp stylesheets/lfs-xsl/*.css $(BASEDIR)/stylesheets
|
---|
| 26 | $(Q)if [ ! -e $(BASEDIR)/images ]; then \
|
---|
[44758be] | 27 | mkdir -p $(BASEDIR)/images; \
|
---|
| 28 | fi;
|
---|
[05d60ce] | 29 | $(Q)cp images/*.png $(BASEDIR)/images
|
---|
| 30 | $(Q)cd $(BASEDIR)/; sed -i -e "s@../stylesheets@stylesheets@g" *.html
|
---|
| 31 | $(Q)cd $(BASEDIR)/; sed -i -e "s@../images@images@g" *.html
|
---|
[287ea55] | 32 |
|
---|
[05d60ce] | 33 | @echo "Running Tidy and obfuscate.sh..."
|
---|
| 34 | $(Q)for filename in `find $(BASEDIR) -name "*.html"`; do \
|
---|
[132fd16] | 35 | tidy -config tidy.conf $$filename; \
|
---|
| 36 | true; \
|
---|
[66195c8] | 37 | /bin/bash obfuscate.sh $$filename; \
|
---|
[3879ebc] | 38 | sed -i -e "s@text/html@application/xhtml+xml@g" $$filename; \
|
---|
| 39 | done;
|
---|
[5470c67] | 40 |
|
---|
[05d60ce] | 41 | $(Q)$(MAKE) wget-list
|
---|
[3a4594b] | 42 |
|
---|
[0e6d3c0] | 43 | pdf: validxml
|
---|
| 44 | @echo "Generating profiled XML for PDF..."
|
---|
[05d60ce] | 45 | $(Q)xsltproc --nonet --stringparam profile.condition pdf \
|
---|
[106dc42] | 46 | --output $(RENDERTMP)/lfs-pdf.xml stylesheets/lfs-xsl/profile.xsl \
|
---|
| 47 | $(RENDERTMP)/lfs-full.xml
|
---|
[0e6d3c0] | 48 |
|
---|
| 49 | @echo "Generating FO file..."
|
---|
[7d39455] | 50 | $(Q)xsltproc --nonet -stringparam rootid "$(ROOT_ID)" \
|
---|
[106dc42] | 51 | --output $(RENDERTMP)/lfs-pdf.fo stylesheets/lfs-pdf.xsl \
|
---|
| 52 | $(RENDERTMP)/lfs-pdf.xml
|
---|
| 53 | $(Q)sed -i -e 's/span="inherit"/span="all"/' $(RENDERTMP)/lfs-pdf.fo
|
---|
[6708e6a] | 54 | $(Q)bash pdf-fixups.sh $(RENDERTMP)/lfs-pdf.fo
|
---|
[0e6d3c0] | 55 |
|
---|
| 56 | @echo "Generating PDF file..."
|
---|
[c948b40] | 57 | $(Q)if [ ! -e $(BASEDIR) ]; then \
|
---|
| 58 | mkdir -p $(BASEDIR); \
|
---|
| 59 | fi;
|
---|
[106dc42] | 60 | $(Q)fop $(RENDERTMP)/lfs-pdf.fo $(BASEDIR)/$(PDF_OUTPUT)
|
---|
[0e6d3c0] | 61 |
|
---|
[8e66c9d] | 62 | nochunks: maketar validxml profile-html
|
---|
[0e6d3c0] | 63 | @echo "Generating non chunked XHTML file..."
|
---|
[7d39455] | 64 | $(Q)xsltproc --nonet -stringparam rootid "$(ROOT_ID)" \
|
---|
[0b158f3] | 65 | --output $(BASEDIR)/$(NOCHUNKS_OUTPUT) \
|
---|
[106dc42] | 66 | stylesheets/lfs-nochunks.xsl $(RENDERTMP)/lfs-html.xml
|
---|
[0e6d3c0] | 67 |
|
---|
| 68 | @echo "Running Tidy..."
|
---|
[05d60ce] | 69 | $(Q)tidy -config tidy.conf $(BASEDIR)/$(NOCHUNKS_OUTPUT) || true
|
---|
| 70 | @echo "Running obfuscate.sh..."
|
---|
[abcee47] | 71 | $(Q)bash obfuscate.sh $(BASEDIR)/$(NOCHUNKS_OUTPUT)
|
---|
[05d60ce] | 72 | $(Q)sed -i -e "s@text/html@application/xhtml+xml@g" \
|
---|
[81fd230] | 73 | $(BASEDIR)/$(NOCHUNKS_OUTPUT)
|
---|
[5094344a] | 74 | $(Q)sed -i -e "s@../wget-list@wget-list@" \
|
---|
| 75 | $(BASEDIR)/$(NOCHUNKS_OUTPUT)
|
---|
| 76 | $(Q)$(MAKE) wget-list
|
---|
[81fd230] | 77 |
|
---|
[106dc42] | 78 | tmpdir:
|
---|
| 79 | @echo "Creating and cleaning $(RENDERTMP)"
|
---|
| 80 | $(Q)[ -d $(RENDERTMP) ] || mkdir -p $(RENDERTMP)
|
---|
| 81 | $(Q)rm -f $(RENDERTMP)/lfs-{full,html,pdf}.xml
|
---|
| 82 | $(Q)rm -f $(RENDERTMP)/lfs-pdf.fo
|
---|
| 83 |
|
---|
| 84 | validxml: tmpdir
|
---|
[1c48007] | 85 | @echo "Processing bootscripts..."
|
---|
[6d13ffb] | 86 | $(Q)bash process-scripts.sh
|
---|
[0e6d3c0] | 87 | @echo "Validating the book..."
|
---|
[05d60ce] | 88 | $(Q)xmllint --nonet --noent --xinclude --postvalid \
|
---|
[106dc42] | 89 | -o $(RENDERTMP)/lfs-full.xml index.xml
|
---|
[1c48007] | 90 | $(Q)rm -f appendices/*.script
|
---|
[63f4150] | 91 | $(Q)./aux-file-data.sh $(RENDERTMP)/lfs-full.xml
|
---|
[1c48007] | 92 |
|
---|
| 93 | maketar:
|
---|
[5dbeba9] | 94 | $(Q)if [ "x$(MAKETAR)" == "x" ]; then \
|
---|
| 95 | echo "Making tarballs..."; \
|
---|
| 96 | sh make-aux-files.sh; \
|
---|
| 97 | fi;
|
---|
[0e6d3c0] | 98 |
|
---|
| 99 | profile-html: validxml
|
---|
| 100 | @echo "Generating profiled XML for XHTML..."
|
---|
[05d60ce] | 101 | $(Q)xsltproc --nonet --stringparam profile.condition html \
|
---|
[106dc42] | 102 | --output $(RENDERTMP)/lfs-html.xml stylesheets/lfs-xsl/profile.xsl \
|
---|
| 103 | $(RENDERTMP)/lfs-full.xml
|
---|
[0e6d3c0] | 104 |
|
---|
| 105 | wget-list:
|
---|
| 106 | @echo "Generating wget list..."
|
---|
[05d60ce] | 107 | $(Q)mkdir -p $(BASEDIR)
|
---|
| 108 | $(Q)xsltproc --xinclude --nonet --output $(BASEDIR)/wget-list \
|
---|
[0e6d3c0] | 109 | stylesheets/wget-list.xsl chapter03/chapter03.xml
|
---|
| 110 |
|
---|
[daed5a3] | 111 | md5sums:
|
---|
| 112 | @echo "Generating md5sum file..."
|
---|
| 113 | $(Q)mkdir -p $(BASEDIR)
|
---|
| 114 | $(Q)xsltproc --xinclude --nonet --output $(BASEDIR)/md5sums \
|
---|
| 115 | stylesheets/md5sum.xsl chapter03/chapter03.xml
|
---|
| 116 | $(Q)sed -i -e "s/BOOTSCRIPTS-MD5SUM/$(shell md5sum lfs-bootscripts*.tar.bz2 | cut -d' ' -f1)/" \
|
---|
| 117 | $(BASEDIR)/md5sums
|
---|
| 118 | $(Q)sed -i -e "s/UDEV-MD5SUM/$(shell md5sum udev-config*.tar.bz2 | cut -d' ' -f1)/" \
|
---|
| 119 | $(BASEDIR)/md5sums
|
---|
| 120 |
|
---|
| 121 |
|
---|
[05d60ce] | 122 | dump-commands: validxml
|
---|
[0e6d3c0] | 123 | @echo "Dumping book commands..."
|
---|
[05d60ce] | 124 | $(Q)xsltproc --output $(DUMPDIR)/ \
|
---|
[106dc42] | 125 | stylesheets/dump-commands.xsl $(RENDERTMP)/lfs-full.xml
|
---|
[2c5e4d5] | 126 |
|
---|
[fbb442e] | 127 | validate: maketar validxml
|
---|
[888d1bb] | 128 | @echo "Validation complete."
|
---|
[0e6d3c0] | 129 |
|
---|
[daed5a3] | 130 | all: lfs nochunks pdf dump-commands md5sums
|
---|
[536b6aa] | 131 |
|
---|
[106dc42] | 132 | .PHONY : all dump-commands lfs nochunks pdf profile-html tmpdir validate \
|
---|
[daed5a3] | 133 | validxml wget-list maketar md5sums
|
---|