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