[35a5259] | 1 | #BASEDIR = ~/lfs-book
|
---|
| 2 | #SYSDDIR = ~/lfs-systemd
|
---|
| 3 | #DUMPDIR = ~/lfs-commands
|
---|
[7d39455] | 4 | RENDERTMP = $(HOME)/tmp
|
---|
| 5 | CHUNK_QUIET = 1
|
---|
| 6 | ROOT_ID =
|
---|
[5fde2f94] | 7 | SHELL = /bin/bash
|
---|
[3a4594b] | 8 |
|
---|
[05d60ce] | 9 | ifdef V
|
---|
| 10 | Q =
|
---|
| 11 | else
|
---|
| 12 | Q = @
|
---|
| 13 | endif
|
---|
| 14 |
|
---|
[35a5259] | 15 | ifndef REV
|
---|
| 16 | REV = sysv
|
---|
| 17 | endif
|
---|
| 18 |
|
---|
| 19 | ifneq ($(REV), sysv)
|
---|
| 20 | ifneq ($(REV), systemd)
|
---|
| 21 | $(error REV must be 'sysv' (default) or 'systemd'.)
|
---|
| 22 | endif
|
---|
| 23 | endif
|
---|
| 24 |
|
---|
| 25 | ifeq ($(REV), sysv)
|
---|
[1aff37f] | 26 | BASEDIR ?= ~/lfs-book
|
---|
| 27 | PDF_OUTPUT ?= LFS-BOOK.pdf
|
---|
| 28 | NOCHUNKS_OUTPUT ?= LFS-BOOK.html
|
---|
| 29 | DUMPDIR ?= ~/lfs-commands
|
---|
[35a5259] | 30 | else
|
---|
[1aff37f] | 31 | BASEDIR ?= ~/lfs-systemd
|
---|
| 32 | PDF_OUTPUT ?= LFS-SYSD-BOOK.pdf
|
---|
| 33 | NOCHUNKS_OUTPUT ?= LFS-SYSD-BOOK.html
|
---|
| 34 | DUMPDIR ?= ~/lfs-sysd-commands
|
---|
[35a5259] | 35 | endif
|
---|
[1118b17] | 36 |
|
---|
[35a5259] | 37 | book: validate profile-html
|
---|
| 38 | @echo "Generating chunked XHTML files at $(BASEDIR)/ ..."
|
---|
[1118b17] | 39 | $(Q)xsltproc --nonet \
|
---|
| 40 | --stringparam chunk.quietly $(CHUNK_QUIET) \
|
---|
| 41 | --stringparam rootid "$(ROOT_ID)" \
|
---|
| 42 | --stringparam base.dir $(BASEDIR)/ \
|
---|
| 43 | stylesheets/lfs-chunked.xsl \
|
---|
[23a0f82] | 44 | $(RENDERTMP)/lfs-html.xml
|
---|
[287ea55] | 45 |
|
---|
[0e6d3c0] | 46 | @echo "Copying CSS code and images..."
|
---|
[77ab7f3] | 47 | $(Q)mkdir -p $(BASEDIR)/stylesheets
|
---|
[05d60ce] | 48 | $(Q)cp stylesheets/lfs-xsl/*.css $(BASEDIR)/stylesheets
|
---|
[77ab7f3] | 49 | $(Q)pushd $(BASEDIR)/ > /dev/null; \
|
---|
| 50 | sed -i -e "s@../stylesheets@stylesheets@g" *.html; \
|
---|
| 51 | popd > /dev/null
|
---|
[1c27a53] | 52 |
|
---|
[77ab7f3] | 53 | $(Q)mkdir -p $(BASEDIR)/images
|
---|
[05d60ce] | 54 | $(Q)cp images/*.png $(BASEDIR)/images
|
---|
[287ea55] | 55 |
|
---|
[05d60ce] | 56 | @echo "Running Tidy and obfuscate.sh..."
|
---|
| 57 | $(Q)for filename in `find $(BASEDIR) -name "*.html"`; do \
|
---|
[77ab7f3] | 58 | tidy -config tidy.conf $$filename; \
|
---|
| 59 | true; \
|
---|
| 60 | /bin/bash obfuscate.sh $$filename; \
|
---|
| 61 | sed -e "s@text/html@application/xhtml+xml@g" \
|
---|
| 62 | -e "s/\xa9/\©/ " \
|
---|
| 63 | -i $$filename; \
|
---|
| 64 | done;
|
---|
[5470c67] | 65 |
|
---|
[77ab7f3] | 66 | $(Q)$(MAKE) --no-print-directory wget-list md5sums
|
---|
[3a4594b] | 67 |
|
---|
[924ab90] | 68 | pdf: validate
|
---|
[0e6d3c0] | 69 | @echo "Generating profiled XML for PDF..."
|
---|
[77ab7f3] | 70 | $(Q)xsltproc --nonet \
|
---|
| 71 | --stringparam profile.condition pdf \
|
---|
| 72 | --output $(RENDERTMP)/lfs-pdf.xml \
|
---|
| 73 | stylesheets/lfs-xsl/profile.xsl \
|
---|
[35a5259] | 74 | $(RENDERTMP)/lfs-html2.xml
|
---|
[0e6d3c0] | 75 |
|
---|
| 76 | @echo "Generating FO file..."
|
---|
[77ab7f3] | 77 | $(Q)xsltproc --nonet \
|
---|
[188e34c] | 78 | --stringparam rootid "$(ROOT_ID)" \
|
---|
| 79 | --output $(RENDERTMP)/lfs-pdf.fo \
|
---|
| 80 | stylesheets/lfs-pdf.xsl \
|
---|
| 81 | $(RENDERTMP)/lfs-pdf.xml
|
---|
| 82 |
|
---|
| 83 | $(Q)sed -i -e 's/span="inherit"/span="all"/' $(RENDERTMP)/lfs-pdf.fo
|
---|
| 84 | $(Q)bash pdf-fixups.sh $(RENDERTMP)/lfs-pdf.fo
|
---|
| 85 |
|
---|
| 86 | @echo "Generating PDF file..."
|
---|
| 87 | $(Q)mkdir -p $(BASEDIR)
|
---|
| 88 |
|
---|
[e8a2adc] | 89 | @echo "Copying images to destination..."
|
---|
| 90 | $(Q)mkdir -p $(BASEDIR)/images
|
---|
| 91 | $(Q)cp images/*.png $(BASEDIR)/images
|
---|
| 92 |
|
---|
[188e34c] | 93 | $(Q)fop -q $(RENDERTMP)/lfs-pdf.fo $(BASEDIR)/$(PDF_OUTPUT) 2>fop.log
|
---|
| 94 | @echo "$(BASEDIR)/$(PDF_OUTPUT) created"
|
---|
| 95 | @echo "fop.log created"
|
---|
| 96 |
|
---|
[924ab90] | 97 | nochunks: validate profile-html
|
---|
[0e6d3c0] | 98 | @echo "Generating non chunked XHTML file..."
|
---|
[77ab7f3] | 99 | $(Q)xsltproc --nonet \
|
---|
| 100 | --stringparam rootid "$(ROOT_ID)" \
|
---|
| 101 | --output $(BASEDIR)/$(NOCHUNKS_OUTPUT) \
|
---|
| 102 | stylesheets/lfs-nochunks.xsl \
|
---|
| 103 | $(RENDERTMP)/lfs-html2.xml
|
---|
[0e6d3c0] | 104 |
|
---|
| 105 | @echo "Running Tidy..."
|
---|
[05d60ce] | 106 | $(Q)tidy -config tidy.conf $(BASEDIR)/$(NOCHUNKS_OUTPUT) || true
|
---|
[77ab7f3] | 107 |
|
---|
[05d60ce] | 108 | @echo "Running obfuscate.sh..."
|
---|
[22bcbdd] | 109 | $(Q)bash obfuscate.sh $(BASEDIR)/$(NOCHUNKS_OUTPUT)
|
---|
| 110 | $(Q)sed -i -e "s@text/html@application/xhtml+xml@g" $(BASEDIR)/$(NOCHUNKS_OUTPUT)
|
---|
| 111 | $(Q)sed -i -e "s@../wget-list@wget-list@" $(BASEDIR)/$(NOCHUNKS_OUTPUT)
|
---|
[e679f0b] | 112 | $(Q)sed -i -e "s@../md5sums@md5sums@" $(BASEDIR)/$(NOCHUNKS_OUTPUT)
|
---|
[77ab7f3] | 113 | $(Q)sed -i -e "s@\xa9@\©@" $(BASEDIR)/$(NOCHUNKS_OUTPUT)
|
---|
| 114 |
|
---|
| 115 | @echo "Output at $(BASEDIR)/$(NOCHUNKS_OUTPUT)"
|
---|
| 116 |
|
---|
[106dc42] | 117 | tmpdir:
|
---|
| 118 | @echo "Creating and cleaning $(RENDERTMP)"
|
---|
[77ab7f3] | 119 | $(Q)mkdir -p $(RENDERTMP)
|
---|
| 120 | $(Q)rm -f $(RENDERTMP)/lfs*.xml
|
---|
[35a5259] | 121 | $(Q)rm -f $(RENDERTMP)/*wget*
|
---|
| 122 | $(Q)rm -f $(RENDERTMP)/*md5sum*
|
---|
[77ab7f3] | 123 | $(Q)rm -f $(RENDERTMP)/*pdf.fo
|
---|
[106dc42] | 124 |
|
---|
[924ab90] | 125 | validate: tmpdir
|
---|
[1c48007] | 126 | @echo "Processing bootscripts..."
|
---|
[6d13ffb] | 127 | $(Q)bash process-scripts.sh
|
---|
[35a5259] | 128 |
|
---|
| 129 | @echo "Adjusting for revision $(REV)..."
|
---|
| 130 | $(Q)xsltproc --nonet \
|
---|
| 131 | --xinclude \
|
---|
| 132 | --output $(RENDERTMP)/lfs-html2.xml \
|
---|
| 133 | --stringparam profile.revision $(REV) \
|
---|
| 134 | stylesheets/lfs-xsl/profile.xsl \
|
---|
| 135 | index.xml
|
---|
| 136 |
|
---|
[0e6d3c0] | 137 | @echo "Validating the book..."
|
---|
[77ab7f3] | 138 | $(Q)xmllint --nonet \
|
---|
| 139 | --noent \
|
---|
| 140 | --postvalid \
|
---|
| 141 | -o $(RENDERTMP)/lfs-full.xml \
|
---|
[35a5259] | 142 | $(RENDERTMP)/lfs-html2.xml
|
---|
| 143 |
|
---|
[1c48007] | 144 | $(Q)rm -f appendices/*.script
|
---|
[63f4150] | 145 | $(Q)./aux-file-data.sh $(RENDERTMP)/lfs-full.xml
|
---|
[924ab90] | 146 | @echo "Validation complete."
|
---|
[1c48007] | 147 |
|
---|
[1118b17] | 148 | profile-html:
|
---|
[0e6d3c0] | 149 | @echo "Generating profiled XML for XHTML..."
|
---|
[77ab7f3] | 150 | $(Q)xsltproc --nonet \
|
---|
| 151 | --stringparam profile.condition html \
|
---|
| 152 | --output $(RENDERTMP)/lfs-html.xml \
|
---|
| 153 | stylesheets/lfs-xsl/profile.xsl \
|
---|
[23a0f82] | 154 | $(RENDERTMP)/lfs-full.xml
|
---|
[0e6d3c0] | 155 |
|
---|
[064222a] | 156 | wget-list: $(BASEDIR)/wget-list
|
---|
[77ab7f3] | 157 | $(BASEDIR)/wget-list: stylesheets/wget-list.xsl chapter03/chapter03.xml \
|
---|
| 158 | packages.ent patches.ent
|
---|
[6288602] | 159 | @echo "Generating consolidated wget list at $(BASEDIR)/wget-list ..."
|
---|
[05d60ce] | 160 | $(Q)mkdir -p $(BASEDIR)
|
---|
[77ab7f3] | 161 |
|
---|
[35a5259] | 162 | $(Q)xsltproc --nonet --xinclude \
|
---|
| 163 | --stringparam profile.revision $(REV) \
|
---|
| 164 | --output $(RENDERTMP)/sysd-wget.xml \
|
---|
| 165 | stylesheets/lfs-xsl/profile.xsl \
|
---|
[77ab7f3] | 166 | chapter03/chapter03.xml
|
---|
| 167 |
|
---|
| 168 | $(Q)xsltproc --xinclude --nonet \
|
---|
| 169 | --output $(BASEDIR)/wget-list \
|
---|
| 170 | stylesheets/wget-list.xsl \
|
---|
| 171 | chapter03/chapter03.xml
|
---|
| 172 |
|
---|
[064222a] | 173 | md5sums: $(BASEDIR)/md5sums
|
---|
[77ab7f3] | 174 | $(BASEDIR)/md5sums: stylesheets/wget-list.xsl chapter03/chapter03.xml \
|
---|
| 175 | packages.ent patches.ent
|
---|
[6288602] | 176 | @echo "Generating consolidated md5sum file at $(BASEDIR)/md5sums ..."
|
---|
[daed5a3] | 177 | $(Q)mkdir -p $(BASEDIR)
|
---|
[77ab7f3] | 178 |
|
---|
| 179 | $(Q)xsltproc --nonet --xinclude \
|
---|
[35a5259] | 180 | --stringparam profile.revision $(REV) \
|
---|
[77ab7f3] | 181 | --output $(RENDERTMP)/sysv-md5sum.xml \
|
---|
| 182 | stylesheets/lfs-xsl/profile.xsl \
|
---|
| 183 | chapter03/chapter03.xml
|
---|
| 184 |
|
---|
| 185 | $(Q)xsltproc --xinclude --nonet \
|
---|
| 186 | --output $(BASEDIR)/md5sums \
|
---|
| 187 | stylesheets/md5sum.xsl \
|
---|
| 188 | $(RENDERTMP)/sysv-md5sum.xml
|
---|
[22bcbdd] | 189 | $(Q)sed -i -e \
|
---|
| 190 | "s/BOOTSCRIPTS-MD5SUM/$(shell md5sum lfs-bootscripts*.tar.bz2 | cut -d' ' -f1)/" \
|
---|
| 191 | $(BASEDIR)/md5sums
|
---|
[daed5a3] | 192 |
|
---|
[924ab90] | 193 | dump-commands: validate
|
---|
[0e6d3c0] | 194 | @echo "Dumping book commands..."
|
---|
[cbd8bf0f] | 195 | # $(Q)xsltproc --nonet \
|
---|
| 196 | # --output $(RENDERTMP)/lfs-html.xml \
|
---|
| 197 | # --stringparam profile.revision $(REV) \
|
---|
| 198 | # stylesheets/lfs-xsl/profile.xsl \
|
---|
| 199 | # $(RENDERTMP)/lfs-full.xml
|
---|
[77ab7f3] | 200 |
|
---|
| 201 | $(Q)rm -rf $(DUMPDIR)
|
---|
| 202 |
|
---|
| 203 | $(Q)xsltproc --output $(DUMPDIR)/ \
|
---|
| 204 | stylesheets/dump-commands.xsl \
|
---|
| 205 | $(RENDERTMP)/lfs-html.xml
|
---|
| 206 | @echo "Dumping book commands complete in $(DUMPDIR)"
|
---|
| 207 |
|
---|
[35a5259] | 208 | all: book nochunks pdf dump-commands
|
---|
[22bcbdd] | 209 |
|
---|
[35a5259] | 210 | .PHONY : all book dump-commands nochunks pdf profile-html tmpdir validate md5sums wget-list
|
---|
[536b6aa] | 211 |
|
---|