[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
|
---|
[6dfcfecc] | 29 | DUMPDIR ?= ~/cross-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 |
|
---|
[b3f1ebb3] | 37 | ifndef ARCH
|
---|
| 38 | ARCH = default
|
---|
| 39 | endif
|
---|
| 40 | ifneq ($(ARCH), default)
|
---|
[fd48baa] | 41 | ifneq ($(ARCH), ml_32)
|
---|
| 42 | ifneq ($(ARCH), ml_x32)
|
---|
| 43 | ifneq ($(ARCH), ml_all)
|
---|
| 44 | $(error ARCH must be either 'default' (default if unset), 'ml_32', 'ml_x32' or 'ml_all'.)
|
---|
| 45 | endif
|
---|
| 46 | endif
|
---|
[b3f1ebb3] | 47 | endif
|
---|
| 48 | endif
|
---|
| 49 |
|
---|
[35a5259] | 50 | book: validate profile-html
|
---|
| 51 | @echo "Generating chunked XHTML files at $(BASEDIR)/ ..."
|
---|
[1118b17] | 52 | $(Q)xsltproc --nonet \
|
---|
| 53 | --stringparam chunk.quietly $(CHUNK_QUIET) \
|
---|
| 54 | --stringparam rootid "$(ROOT_ID)" \
|
---|
| 55 | --stringparam base.dir $(BASEDIR)/ \
|
---|
| 56 | stylesheets/lfs-chunked.xsl \
|
---|
[23a0f82] | 57 | $(RENDERTMP)/lfs-html.xml
|
---|
[287ea55] | 58 |
|
---|
[0e6d3c0] | 59 | @echo "Copying CSS code and images..."
|
---|
[77ab7f3] | 60 | $(Q)mkdir -p $(BASEDIR)/stylesheets
|
---|
[05d60ce] | 61 | $(Q)cp stylesheets/lfs-xsl/*.css $(BASEDIR)/stylesheets
|
---|
[df732b5] | 62 | $(Q)sed -i 's|../stylesheet|stylesheet|' $(BASEDIR)/index.html
|
---|
[1c27a53] | 63 |
|
---|
[77ab7f3] | 64 | $(Q)mkdir -p $(BASEDIR)/images
|
---|
[05d60ce] | 65 | $(Q)cp images/*.png $(BASEDIR)/images
|
---|
[287ea55] | 66 |
|
---|
[05d60ce] | 67 | @echo "Running Tidy and obfuscate.sh..."
|
---|
| 68 | $(Q)for filename in `find $(BASEDIR) -name "*.html"`; do \
|
---|
[77ab7f3] | 69 | tidy -config tidy.conf $$filename; \
|
---|
| 70 | true; \
|
---|
| 71 | /bin/bash obfuscate.sh $$filename; \
|
---|
| 72 | sed -e "s@text/html@application/xhtml+xml@g" \
|
---|
| 73 | -e "s/\xa9/\©/ " \
|
---|
| 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 | $(Q)sed -i -e "s@\xa9@\©@" $(BASEDIR)/$(NOCHUNKS_OUTPUT)
|
---|
| 125 |
|
---|
| 126 | @echo "Output at $(BASEDIR)/$(NOCHUNKS_OUTPUT)"
|
---|
| 127 |
|
---|
[106dc42] | 128 | tmpdir:
|
---|
| 129 | @echo "Creating and cleaning $(RENDERTMP)"
|
---|
[77ab7f3] | 130 | $(Q)mkdir -p $(RENDERTMP)
|
---|
| 131 | $(Q)rm -f $(RENDERTMP)/lfs*.xml
|
---|
[35a5259] | 132 | $(Q)rm -f $(RENDERTMP)/*wget*
|
---|
| 133 | $(Q)rm -f $(RENDERTMP)/*md5sum*
|
---|
[77ab7f3] | 134 | $(Q)rm -f $(RENDERTMP)/*pdf.fo
|
---|
[106dc42] | 135 |
|
---|
[59483809] | 136 | validate: tmpdir version
|
---|
[1c48007] | 137 | @echo "Processing bootscripts..."
|
---|
[6d13ffb] | 138 | $(Q)bash process-scripts.sh
|
---|
[35a5259] | 139 |
|
---|
| 140 | @echo "Adjusting for revision $(REV)..."
|
---|
| 141 | $(Q)xsltproc --nonet \
|
---|
| 142 | --xinclude \
|
---|
| 143 | --output $(RENDERTMP)/lfs-html2.xml \
|
---|
| 144 | --stringparam profile.revision $(REV) \
|
---|
[b3f1ebb3] | 145 | --stringparam profile.arch $(ARCH) \
|
---|
[35a5259] | 146 | stylesheets/lfs-xsl/profile.xsl \
|
---|
| 147 | index.xml
|
---|
| 148 |
|
---|
[0e6d3c0] | 149 | @echo "Validating the book..."
|
---|
[77ab7f3] | 150 | $(Q)xmllint --nonet \
|
---|
| 151 | --noent \
|
---|
| 152 | --postvalid \
|
---|
| 153 | -o $(RENDERTMP)/lfs-full.xml \
|
---|
[35a5259] | 154 | $(RENDERTMP)/lfs-html2.xml
|
---|
| 155 |
|
---|
[1c48007] | 156 | $(Q)rm -f appendices/*.script
|
---|
[63f4150] | 157 | $(Q)./aux-file-data.sh $(RENDERTMP)/lfs-full.xml
|
---|
[924ab90] | 158 | @echo "Validation complete."
|
---|
[1c48007] | 159 |
|
---|
[3781c69] | 160 | profile-html:
|
---|
[0e6d3c0] | 161 | @echo "Generating profiled XML for XHTML..."
|
---|
[77ab7f3] | 162 | $(Q)xsltproc --nonet \
|
---|
| 163 | --stringparam profile.condition html \
|
---|
| 164 | --output $(RENDERTMP)/lfs-html.xml \
|
---|
| 165 | stylesheets/lfs-xsl/profile.xsl \
|
---|
[23a0f82] | 166 | $(RENDERTMP)/lfs-full.xml
|
---|
[0e6d3c0] | 167 |
|
---|
[064222a] | 168 | wget-list: $(BASEDIR)/wget-list
|
---|
[77ab7f3] | 169 | $(BASEDIR)/wget-list: stylesheets/wget-list.xsl chapter03/chapter03.xml \
|
---|
[6218cdb] | 170 | packages.ent patches.ent general.ent
|
---|
[6288602] | 171 | @echo "Generating consolidated wget list at $(BASEDIR)/wget-list ..."
|
---|
[05d60ce] | 172 | $(Q)mkdir -p $(BASEDIR)
|
---|
[77ab7f3] | 173 |
|
---|
[d4407c7] | 174 | # $(Q)xsltproc --nonet --xinclude \
|
---|
| 175 | # --stringparam profile.revision $(REV) \
|
---|
| 176 | # --output $(RENDERTMP)/sysd-wget.xml \
|
---|
| 177 | # stylesheets/lfs-xsl/profile.xsl \
|
---|
| 178 | # chapter03/chapter03.xml
|
---|
[77ab7f3] | 179 |
|
---|
| 180 | $(Q)xsltproc --xinclude --nonet \
|
---|
| 181 | --output $(BASEDIR)/wget-list \
|
---|
| 182 | stylesheets/wget-list.xsl \
|
---|
| 183 | chapter03/chapter03.xml
|
---|
| 184 |
|
---|
[064222a] | 185 | md5sums: $(BASEDIR)/md5sums
|
---|
[77ab7f3] | 186 | $(BASEDIR)/md5sums: stylesheets/wget-list.xsl chapter03/chapter03.xml \
|
---|
| 187 | packages.ent patches.ent
|
---|
[6288602] | 188 | @echo "Generating consolidated md5sum file at $(BASEDIR)/md5sums ..."
|
---|
[daed5a3] | 189 | $(Q)mkdir -p $(BASEDIR)
|
---|
[77ab7f3] | 190 |
|
---|
| 191 | $(Q)xsltproc --nonet --xinclude \
|
---|
[35a5259] | 192 | --stringparam profile.revision $(REV) \
|
---|
[6dfcfecc] | 193 | --stringparam profile.arch $(ARCH) \
|
---|
[77ab7f3] | 194 | --output $(RENDERTMP)/sysv-md5sum.xml \
|
---|
| 195 | stylesheets/lfs-xsl/profile.xsl \
|
---|
| 196 | chapter03/chapter03.xml
|
---|
| 197 |
|
---|
| 198 | $(Q)xsltproc --xinclude --nonet \
|
---|
| 199 | --output $(BASEDIR)/md5sums \
|
---|
| 200 | stylesheets/md5sum.xsl \
|
---|
| 201 | $(RENDERTMP)/sysv-md5sum.xml
|
---|
[22bcbdd] | 202 | $(Q)sed -i -e \
|
---|
[b2c61c6] | 203 | "s/BOOTSCRIPTS-MD5SUM/$(shell md5sum lfs-bootscripts*.tar.xz | cut -d' ' -f1)/" \
|
---|
[22bcbdd] | 204 | $(BASEDIR)/md5sums
|
---|
[daed5a3] | 205 |
|
---|
[59483809] | 206 | version:
|
---|
[4467b18d] | 207 | $(Q)./git-version.sh $(REV)
|
---|
[59483809] | 208 |
|
---|
[f0ba388] | 209 | #dump-commands: validate
|
---|
| 210 | # @echo "Dumping book commands..."
|
---|
[cbd8bf0f] | 211 | # $(Q)xsltproc --nonet \
|
---|
| 212 | # --output $(RENDERTMP)/lfs-html.xml \
|
---|
| 213 | # --stringparam profile.revision $(REV) \
|
---|
| 214 | # stylesheets/lfs-xsl/profile.xsl \
|
---|
| 215 | # $(RENDERTMP)/lfs-full.xml
|
---|
[77ab7f3] | 216 |
|
---|
[f0ba388] | 217 | # $(Q)rm -rf $(DUMPDIR)
|
---|
[77ab7f3] | 218 |
|
---|
[f0ba388] | 219 | # $(Q)xsltproc --output $(DUMPDIR)/ \
|
---|
| 220 | # stylesheets/dump-commands.xsl \
|
---|
| 221 | # $(RENDERTMP)/lfs-html.xml
|
---|
| 222 | # @echo "Dumping book commands complete in $(DUMPDIR)"
|
---|
[77ab7f3] | 223 |
|
---|
[f0ba388] | 224 | all: book nochunks pdf # dump-commands
|
---|
[22bcbdd] | 225 |
|
---|
[59483809] | 226 | .PHONY : all book dump-commands nochunks pdf profile-html tmpdir validate md5sums wget-list version
|
---|
[536b6aa] | 227 |
|
---|