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