[7d39455] | 1 | BASEDIR = ~/lfs-book
|
---|
[1118b17] | 2 | SYSDDIR = ~/lfs-systemd
|
---|
[7d39455] | 3 | DUMPDIR = ~/lfs-commands
|
---|
| 4 | RENDERTMP = $(HOME)/tmp
|
---|
| 5 | CHUNK_QUIET = 1
|
---|
| 6 | ROOT_ID =
|
---|
| 7 | PDF_OUTPUT = LFS-BOOK.pdf
|
---|
| 8 | NOCHUNKS_OUTPUT = LFS-BOOK.html
|
---|
[77ab7f3] | 9 | NOCHUNKS_SYSD_FILE = LFS-SYSD-BOOK.html
|
---|
[5fde2f94] | 10 | SHELL = /bin/bash
|
---|
[3a4594b] | 11 |
|
---|
[05d60ce] | 12 | ifdef V
|
---|
| 13 | Q =
|
---|
| 14 | else
|
---|
| 15 | Q = @
|
---|
| 16 | endif
|
---|
| 17 |
|
---|
[1118b17] | 18 | sysv: validate profile-html
|
---|
| 19 | $(Q)xsltproc --nonet \
|
---|
| 20 | --output $(RENDERTMP)/lfs-html2.xml \
|
---|
| 21 | --stringparam profile.revision sysv \
|
---|
| 22 | stylesheets/lfs-xsl/profile.xsl \
|
---|
| 23 | $(RENDERTMP)/lfs-html.xml
|
---|
| 24 |
|
---|
[0e6d3c0] | 25 | @echo "Generating chunked XHTML files..."
|
---|
[1118b17] | 26 | $(Q)xsltproc --nonet \
|
---|
| 27 | --stringparam chunk.quietly $(CHUNK_QUIET) \
|
---|
| 28 | --stringparam rootid "$(ROOT_ID)" \
|
---|
| 29 | --stringparam base.dir $(BASEDIR)/ \
|
---|
| 30 | stylesheets/lfs-chunked.xsl \
|
---|
| 31 | $(RENDERTMP)/lfs-html2.xml
|
---|
[287ea55] | 32 |
|
---|
[0e6d3c0] | 33 | @echo "Copying CSS code and images..."
|
---|
[77ab7f3] | 34 | $(Q)mkdir -p $(BASEDIR)/stylesheets
|
---|
[05d60ce] | 35 | $(Q)cp stylesheets/lfs-xsl/*.css $(BASEDIR)/stylesheets
|
---|
[77ab7f3] | 36 | $(Q)pushd $(BASEDIR)/ > /dev/null; \
|
---|
| 37 | sed -i -e "s@../stylesheets@stylesheets@g" *.html; \
|
---|
| 38 | popd > /dev/null
|
---|
[1c27a53] | 39 |
|
---|
[77ab7f3] | 40 | $(Q)mkdir -p $(BASEDIR)/images
|
---|
[05d60ce] | 41 | $(Q)cp images/*.png $(BASEDIR)/images
|
---|
[287ea55] | 42 |
|
---|
[05d60ce] | 43 | @echo "Running Tidy and obfuscate.sh..."
|
---|
| 44 | $(Q)for filename in `find $(BASEDIR) -name "*.html"`; do \
|
---|
[77ab7f3] | 45 | tidy -config tidy.conf $$filename; \
|
---|
| 46 | true; \
|
---|
| 47 | /bin/bash obfuscate.sh $$filename; \
|
---|
| 48 | sed -e "s@text/html@application/xhtml+xml@g" \
|
---|
| 49 | -e "s/\xa9/\©/ " \
|
---|
| 50 | -i $$filename; \
|
---|
| 51 | done;
|
---|
[5470c67] | 52 |
|
---|
[77ab7f3] | 53 | $(Q)$(MAKE) --no-print-directory wget-list md5sums
|
---|
[3a4594b] | 54 |
|
---|
[1118b17] | 55 | systemd: validated profile-html
|
---|
| 56 | $(Q)xsltproc --nonet \
|
---|
| 57 | --output $(RENDERTMP)/lfs-html2.xml \
|
---|
| 58 | --stringparam profile.revision systemd \
|
---|
| 59 | stylesheets/lfs-xsl/profile.xsl \
|
---|
| 60 | $(RENDERTMP)/lfs-html.xml
|
---|
| 61 |
|
---|
| 62 | @echo "Generating chunked XHTML files..."
|
---|
| 63 | $(Q)xsltproc --nonet \
|
---|
| 64 | --stringparam chunk.quietly $(CHUNK_QUIET) \
|
---|
| 65 | --stringparam rootid "$(ROOT_ID)" \
|
---|
| 66 | --stringparam base.dir $(SYSDDIR)/ \
|
---|
| 67 | stylesheets/lfs-chunked.xsl \
|
---|
| 68 | $(RENDERTMP)/lfs-html2.xml
|
---|
| 69 |
|
---|
| 70 | @echo "Copying CSS code and images..."
|
---|
[77ab7f3] | 71 | $(Q)mkdir -p $(SYSDDIR)/stylesheets
|
---|
[1118b17] | 72 | $(Q)cp stylesheets/lfs-xsl/*.css $(SYSDDIR)/stylesheets
|
---|
| 73 |
|
---|
[77ab7f3] | 74 | $(Q)mkdir -p $(SYSDDIR)/images
|
---|
[1118b17] | 75 | $(Q)cp images/*.png $(SYSDDIR)/images
|
---|
| 76 |
|
---|
| 77 | @echo "Running Tidy and obfuscate.sh..."
|
---|
| 78 | $(Q)for filename in `find $(SYSDDIR) -name "*.html"`; do \
|
---|
[77ab7f3] | 79 | tidy -config tidy.conf $$filename; \
|
---|
| 80 | true; \
|
---|
| 81 | /bin/bash obfuscate.sh $$filename; \
|
---|
| 82 | sed -e "s@text/html@application/xhtml+xml@g" \
|
---|
| 83 | -e "s/\xa9/\©/ " \
|
---|
| 84 | -i $$filename; \
|
---|
| 85 | done;
|
---|
[1118b17] | 86 |
|
---|
[77ab7f3] | 87 | $(Q)$(MAKE) --no-print-directory wget-listd md5sumsd
|
---|
[1118b17] | 88 |
|
---|
[924ab90] | 89 | pdf: validate
|
---|
[0e6d3c0] | 90 | @echo "Generating profiled XML for PDF..."
|
---|
[77ab7f3] | 91 | $(Q)xsltproc --nonet \
|
---|
| 92 | --stringparam profile.condition pdf \
|
---|
| 93 | --stringparam profile.revision sysv \
|
---|
| 94 | --output $(RENDERTMP)/lfs-pdf.xml \
|
---|
| 95 | stylesheets/lfs-xsl/profile.xsl \
|
---|
| 96 | $(RENDERTMP)/lfs-full.xml
|
---|
[0e6d3c0] | 97 |
|
---|
| 98 | @echo "Generating FO file..."
|
---|
[77ab7f3] | 99 | $(Q)xsltproc --nonet \
|
---|
| 100 | --stringparam rootid "$(ROOT_ID)" \
|
---|
| 101 | --output $(RENDERTMP)/lfs-pdf.fo \
|
---|
| 102 | stylesheets/lfs-pdf.xsl \
|
---|
| 103 | $(RENDERTMP)/lfs-pdf.xml
|
---|
| 104 |
|
---|
[106dc42] | 105 | $(Q)sed -i -e 's/span="inherit"/span="all"/' $(RENDERTMP)/lfs-pdf.fo
|
---|
[6708e6a] | 106 | $(Q)bash pdf-fixups.sh $(RENDERTMP)/lfs-pdf.fo
|
---|
[0e6d3c0] | 107 |
|
---|
| 108 | @echo "Generating PDF file..."
|
---|
[77ab7f3] | 109 | $(Q)mkdir -p $(BASEDIR)
|
---|
| 110 |
|
---|
[ed480958] | 111 | $(Q)fop -q $(RENDERTMP)/lfs-pdf.fo $(BASEDIR)/$(PDF_OUTPUT) 2>fop.log
|
---|
| 112 | @echo "$(BASEDIR)/$(PDF_OUTPUT) created"
|
---|
| 113 | @echo "fop.log created"
|
---|
[0e6d3c0] | 114 |
|
---|
[924ab90] | 115 | nochunks: validate profile-html
|
---|
[77ab7f3] | 116 | $(Q)xsltproc --nonet \
|
---|
| 117 | --output $(RENDERTMP)/lfs-html2.xml \
|
---|
| 118 | --stringparam profile.revision sysv \
|
---|
| 119 | stylesheets/lfs-xsl/profile.xsl \
|
---|
| 120 | $(RENDERTMP)/lfs-html.xml
|
---|
| 121 |
|
---|
[0e6d3c0] | 122 | @echo "Generating non chunked XHTML file..."
|
---|
[77ab7f3] | 123 | $(Q)xsltproc --nonet \
|
---|
| 124 | --stringparam rootid "$(ROOT_ID)" \
|
---|
| 125 | --output $(BASEDIR)/$(NOCHUNKS_OUTPUT) \
|
---|
| 126 | stylesheets/lfs-nochunks.xsl \
|
---|
| 127 | $(RENDERTMP)/lfs-html2.xml
|
---|
[0e6d3c0] | 128 |
|
---|
| 129 | @echo "Running Tidy..."
|
---|
[05d60ce] | 130 | $(Q)tidy -config tidy.conf $(BASEDIR)/$(NOCHUNKS_OUTPUT) || true
|
---|
[77ab7f3] | 131 |
|
---|
[05d60ce] | 132 | @echo "Running obfuscate.sh..."
|
---|
[22bcbdd] | 133 | $(Q)bash obfuscate.sh $(BASEDIR)/$(NOCHUNKS_OUTPUT)
|
---|
| 134 | $(Q)sed -i -e "s@text/html@application/xhtml+xml@g" $(BASEDIR)/$(NOCHUNKS_OUTPUT)
|
---|
| 135 | $(Q)sed -i -e "s@../wget-list@wget-list@" $(BASEDIR)/$(NOCHUNKS_OUTPUT)
|
---|
[e679f0b] | 136 | $(Q)sed -i -e "s@../md5sums@md5sums@" $(BASEDIR)/$(NOCHUNKS_OUTPUT)
|
---|
[77ab7f3] | 137 | $(Q)sed -i -e "s@\xa9@\©@" $(BASEDIR)/$(NOCHUNKS_OUTPUT)
|
---|
| 138 |
|
---|
| 139 | @echo "Output at $(BASEDIR)/$(NOCHUNKS_OUTPUT)"
|
---|
| 140 |
|
---|
| 141 | nochunksd: validated profile-html
|
---|
| 142 | $(Q)xsltproc --nonet \
|
---|
| 143 | --output $(RENDERTMP)/lfs-html2.xml \
|
---|
| 144 | --stringparam profile.revision systemd \
|
---|
| 145 | stylesheets/lfs-xsl/profile.xsl \
|
---|
| 146 | $(RENDERTMP)/lfs-html.xml
|
---|
| 147 |
|
---|
| 148 | @echo "Generating non chunked XHTML file..."
|
---|
| 149 | $(Q)xsltproc --nonet \
|
---|
| 150 | --stringparam rootid "$(ROOT_ID)" \
|
---|
| 151 | --output $(SYSDDIR)/$(NOCHUNKS_SYSD_FILE) \
|
---|
| 152 | stylesheets/lfs-nochunks.xsl \
|
---|
| 153 | $(RENDERTMP)/lfs-html2.xml
|
---|
| 154 |
|
---|
| 155 | @echo "Running Tidy..."
|
---|
| 156 | $(Q)tidy -config tidy.conf $(SYSDDIR)/$(NOCHUNKS_SYSD_FILE) || true
|
---|
| 157 |
|
---|
| 158 | @echo "Running obfuscate.sh..."
|
---|
| 159 | $(Q)bash obfuscate.sh $(SYSDDIR)/$(NOCHUNKS_SYSD_FILE)
|
---|
| 160 | $(Q)sed -i -e "s@text/html@application/xhtml+xml@g" $(SYSDDIR)/$(NOCHUNKS_SYSD_FILE)
|
---|
| 161 | $(Q)sed -i -e "s@../wget-list@wget-list@" $(SYSDDIR)/$(NOCHUNKS_SYSD_FILE)
|
---|
| 162 | $(Q)sed -i -e "s@../md5sums@md5sums@" $(SYSDDIR)/$(NOCHUNKS_SYSD_FILE)
|
---|
| 163 | $(Q)sed -i -e "s@\xa9@\©@" $(SYSDDIR)/$(NOCHUNKS_SYSD_FILE)
|
---|
| 164 |
|
---|
| 165 | @echo "Output at $(SYSDDIR)/$(NOCHUNKS_SYSD_FILE)"
|
---|
[81fd230] | 166 |
|
---|
[106dc42] | 167 | tmpdir:
|
---|
| 168 | @echo "Creating and cleaning $(RENDERTMP)"
|
---|
[77ab7f3] | 169 | $(Q)mkdir -p $(RENDERTMP)
|
---|
| 170 | $(Q)rm -f $(RENDERTMP)/lfs*.xml
|
---|
| 171 | $(Q)rm -f $(RENDERTMP)/sysd*.xml
|
---|
| 172 | $(Q)rm -f $(RENDERTMP)/*pdf.fo
|
---|
[106dc42] | 173 |
|
---|
[924ab90] | 174 | validate: tmpdir
|
---|
[1c48007] | 175 | @echo "Processing bootscripts..."
|
---|
[6d13ffb] | 176 | $(Q)bash process-scripts.sh
|
---|
[0e6d3c0] | 177 | @echo "Validating the book..."
|
---|
[77ab7f3] | 178 | $(Q)xmllint --nonet \
|
---|
| 179 | --noent \
|
---|
| 180 | --xinclude \
|
---|
| 181 | --postvalid \
|
---|
| 182 | -o $(RENDERTMP)/lfs-full.xml \
|
---|
| 183 | index.xml
|
---|
[1c48007] | 184 | $(Q)rm -f appendices/*.script
|
---|
[63f4150] | 185 | $(Q)./aux-file-data.sh $(RENDERTMP)/lfs-full.xml
|
---|
[924ab90] | 186 | @echo "Validation complete."
|
---|
[1c48007] | 187 |
|
---|
[1118b17] | 188 | validated: tmpdir
|
---|
| 189 | @echo "Validating the book..."
|
---|
[77ab7f3] | 190 | $(Q)xmllint --nonet \
|
---|
| 191 | --noent \
|
---|
| 192 | --xinclude \
|
---|
| 193 | --postvalid \
|
---|
| 194 | -o $(RENDERTMP)/lfs-full.xml \
|
---|
| 195 | indexd.xml
|
---|
[1118b17] | 196 | @echo "Validation complete."
|
---|
| 197 |
|
---|
| 198 | profile-html:
|
---|
[0e6d3c0] | 199 | @echo "Generating profiled XML for XHTML..."
|
---|
[77ab7f3] | 200 | $(Q)xsltproc --nonet \
|
---|
| 201 | --stringparam profile.condition html \
|
---|
| 202 | --output $(RENDERTMP)/lfs-html.xml \
|
---|
| 203 | stylesheets/lfs-xsl/profile.xsl \
|
---|
| 204 | $(RENDERTMP)/lfs-full.xml
|
---|
[0e6d3c0] | 205 |
|
---|
[064222a] | 206 | wget-list: $(BASEDIR)/wget-list
|
---|
[77ab7f3] | 207 | $(BASEDIR)/wget-list: stylesheets/wget-list.xsl chapter03/chapter03.xml \
|
---|
| 208 | packages.ent patches.ent
|
---|
| 209 | @echo "Generating wget list for sysv..."
|
---|
[05d60ce] | 210 | $(Q)mkdir -p $(BASEDIR)
|
---|
[77ab7f3] | 211 |
|
---|
| 212 | $(Q)xsltproc --nonet --xinclude \
|
---|
| 213 | --stringparam profile.revision sysv \
|
---|
| 214 | --output $(RENDERTMP)/sysd-wget.xml \
|
---|
| 215 | stylesheets/lfs-xsl/profile.xsl \
|
---|
| 216 | chapter03/chapter03.xml
|
---|
| 217 |
|
---|
| 218 | $(Q)xsltproc --xinclude --nonet \
|
---|
| 219 | --output $(BASEDIR)/wget-list \
|
---|
| 220 | stylesheets/wget-list.xsl \
|
---|
| 221 | chapter03/chapter03.xml
|
---|
| 222 |
|
---|
| 223 | wget-listd: $(SYSDDIR)/wget-listd
|
---|
| 224 | $(SYSDDIR)/wget-listd: stylesheets/wget-list.xsl chapter03/chapter03.xml \
|
---|
| 225 | packages.ent patches.ent
|
---|
| 226 | @echo "Generating wget list for systemd..."
|
---|
| 227 | $(Q)mkdir -p $(SYSDDIR)
|
---|
| 228 |
|
---|
| 229 | $(Q)xsltproc --xinclude --nonet \
|
---|
| 230 | --stringparam profile.revision systemd \
|
---|
| 231 | --output $(RENDERTMP)/sysd-wget.xml \
|
---|
| 232 | stylesheets/lfs-xsl/profile.xsl \
|
---|
| 233 | chapter03/chapter03.xml
|
---|
| 234 |
|
---|
| 235 | $(Q)xsltproc --xinclude --nonet \
|
---|
| 236 | --output $(SYSDDIR)/wget-list \
|
---|
| 237 | stylesheets/wget-list.xsl \
|
---|
| 238 | $(RENDERTMP)/sysd-wget.xml
|
---|
[0e6d3c0] | 239 |
|
---|
[064222a] | 240 | md5sums: $(BASEDIR)/md5sums
|
---|
[77ab7f3] | 241 | $(BASEDIR)/md5sums: stylesheets/wget-list.xsl chapter03/chapter03.xml \
|
---|
| 242 | packages.ent patches.ent
|
---|
| 243 | @echo "Generating md5sum file for sysv..."
|
---|
[daed5a3] | 244 | $(Q)mkdir -p $(BASEDIR)
|
---|
[77ab7f3] | 245 |
|
---|
| 246 | $(Q)xsltproc --nonet --xinclude \
|
---|
| 247 | --stringparam profile.revision sysv \
|
---|
| 248 | --output $(RENDERTMP)/sysv-md5sum.xml \
|
---|
| 249 | stylesheets/lfs-xsl/profile.xsl \
|
---|
| 250 | chapter03/chapter03.xml
|
---|
| 251 |
|
---|
| 252 | $(Q)xsltproc --xinclude --nonet \
|
---|
| 253 | --output $(BASEDIR)/md5sums \
|
---|
| 254 | stylesheets/md5sum.xsl \
|
---|
| 255 | $(RENDERTMP)/sysv-md5sum.xml
|
---|
[22bcbdd] | 256 | $(Q)sed -i -e \
|
---|
| 257 | "s/BOOTSCRIPTS-MD5SUM/$(shell md5sum lfs-bootscripts*.tar.bz2 | cut -d' ' -f1)/" \
|
---|
| 258 | $(BASEDIR)/md5sums
|
---|
[daed5a3] | 259 |
|
---|
[77ab7f3] | 260 | md5sumsd: $(SYSDDIR)/md5sums
|
---|
| 261 | $(SYSDDIR)/md5sums: stylesheets/wget-list.xsl chapter03/chapter03.xml \
|
---|
| 262 | packages.ent patches.ent
|
---|
| 263 | @echo "Generating md5sum file for systemd..."
|
---|
[1118b17] | 264 | $(Q)mkdir -p $(SYSDDIR)
|
---|
[77ab7f3] | 265 | $(Q)xsltproc --nonet --xinclude \
|
---|
| 266 | --stringparam profile.revision systemd \
|
---|
| 267 | --output $(RENDERTMP)/sysd-md5sum.xml \
|
---|
| 268 | stylesheets/lfs-xsl/profile.xsl \
|
---|
| 269 | chapter03/chapter03.xml
|
---|
| 270 |
|
---|
| 271 | $(Q)xsltproc --xinclude --nonet \
|
---|
| 272 | --output $(SYSDDIR)/md5sums \
|
---|
| 273 | stylesheets/md5sum.xsl \
|
---|
| 274 | $(RENDERTMP)/sysd-md5sum.xml
|
---|
[1118b17] | 275 |
|
---|
[924ab90] | 276 | dump-commands: validate
|
---|
[0e6d3c0] | 277 | @echo "Dumping book commands..."
|
---|
[77ab7f3] | 278 | $(Q)xsltproc --nonet \
|
---|
| 279 | --output $(RENDERTMP)/lfs-html.xml \
|
---|
| 280 | --stringparam profile.revision sysv \
|
---|
| 281 | stylesheets/lfs-xsl/profile.xsl \
|
---|
| 282 | $(RENDERTMP)/lfs-full.xml
|
---|
| 283 |
|
---|
| 284 | $(Q)rm -rf $(DUMPDIR)
|
---|
| 285 |
|
---|
| 286 | $(Q)xsltproc --output $(DUMPDIR)/ \
|
---|
| 287 | stylesheets/dump-commands.xsl \
|
---|
| 288 | $(RENDERTMP)/lfs-html.xml
|
---|
| 289 | @echo "Dumping book commands complete in $(DUMPDIR)"
|
---|
| 290 |
|
---|
| 291 | dump-commandsd: validated
|
---|
| 292 | @echo "Dumping book commands..."
|
---|
| 293 | $(Q)xsltproc --nonet \
|
---|
| 294 | --output $(RENDERTMP)/lfs-html.xml \
|
---|
| 295 | --stringparam profile.revision systemd \
|
---|
| 296 | stylesheets/lfs-xsl/profile.xsl \
|
---|
| 297 | $(RENDERTMP)/lfs-full.xml
|
---|
[2c5e4d5] | 298 |
|
---|
[77ab7f3] | 299 | $(Q)rm -rf $(DUMPDIR)
|
---|
| 300 |
|
---|
| 301 | $(Q)xsltproc --output $(DUMPDIR)/ \
|
---|
| 302 | stylesheets/dump-commands.xsl \
|
---|
| 303 | $(RENDERTMP)/lfs-html.xml
|
---|
| 304 | @echo "Dumping book commands complete in $(DUMPDIR)"
|
---|
[0e6d3c0] | 305 |
|
---|
[22bcbdd] | 306 | all: lfs nochunks pdf dump-commands
|
---|
| 307 |
|
---|
[77ab7f3] | 308 | .PHONY : all sysv systemd dump-commands lfs nochunks pdf profile-html tmpdir validate
|
---|
[536b6aa] | 309 |
|
---|