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