[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)
|
---|
[193913e] | 21 | ifneq ($(REV), s6)
|
---|
| 22 | $(error REV must be 'sysv' (default), 'systemd' or 's6'.)
|
---|
| 23 | endif
|
---|
[35a5259] | 24 | endif
|
---|
| 25 | endif
|
---|
| 26 |
|
---|
| 27 | ifeq ($(REV), sysv)
|
---|
[193913e] | 28 | # SysV
|
---|
[1aff37f] | 29 | BASEDIR ?= ~/lfs-book
|
---|
| 30 | PDF_OUTPUT ?= LFS-BOOK.pdf
|
---|
| 31 | NOCHUNKS_OUTPUT ?= LFS-BOOK.html
|
---|
[fcc02767] | 32 | DUMPDIR ?= ~/cross-lfs-commands
|
---|
[35a5259] | 33 | else
|
---|
[193913e] | 34 | ifeq ($(REV), systemd)
|
---|
| 35 | # systemd
|
---|
[1aff37f] | 36 | BASEDIR ?= ~/lfs-systemd
|
---|
| 37 | PDF_OUTPUT ?= LFS-SYSD-BOOK.pdf
|
---|
| 38 | NOCHUNKS_OUTPUT ?= LFS-SYSD-BOOK.html
|
---|
| 39 | DUMPDIR ?= ~/lfs-sysd-commands
|
---|
[193913e] | 40 | else
|
---|
| 41 | # S6
|
---|
| 42 | BASEDIR ?= ~/lfs-s6
|
---|
| 43 | PDF_OUTPUT ?= LFS-S6-BOOK.pdf
|
---|
| 44 | NOCHUNKS_OUTPUT ?= LFS-S6-BOOK.html
|
---|
| 45 | DUMPDIR ?= ~/lfs-s6-commands
|
---|
| 46 | endif
|
---|
[35a5259] | 47 | endif
|
---|
[1118b17] | 48 |
|
---|
[35a5259] | 49 | book: validate profile-html
|
---|
| 50 | @echo "Generating chunked XHTML files at $(BASEDIR)/ ..."
|
---|
[1118b17] | 51 | $(Q)xsltproc --nonet \
|
---|
| 52 | --stringparam chunk.quietly $(CHUNK_QUIET) \
|
---|
| 53 | --stringparam rootid "$(ROOT_ID)" \
|
---|
| 54 | --stringparam base.dir $(BASEDIR)/ \
|
---|
| 55 | stylesheets/lfs-chunked.xsl \
|
---|
[23a0f82] | 56 | $(RENDERTMP)/lfs-html.xml
|
---|
[287ea55] | 57 |
|
---|
[0e6d3c0] | 58 | @echo "Copying CSS code and images..."
|
---|
[77ab7f3] | 59 | $(Q)mkdir -p $(BASEDIR)/stylesheets
|
---|
[05d60ce] | 60 | $(Q)cp stylesheets/lfs-xsl/*.css $(BASEDIR)/stylesheets
|
---|
[df732b5] | 61 | $(Q)sed -i 's|../stylesheet|stylesheet|' $(BASEDIR)/index.html
|
---|
[1c27a53] | 62 |
|
---|
[77ab7f3] | 63 | $(Q)mkdir -p $(BASEDIR)/images
|
---|
[05d60ce] | 64 | $(Q)cp images/*.png $(BASEDIR)/images
|
---|
[287ea55] | 65 |
|
---|
[05d60ce] | 66 | @echo "Running Tidy and obfuscate.sh..."
|
---|
| 67 | $(Q)for filename in `find $(BASEDIR) -name "*.html"`; do \
|
---|
[77ab7f3] | 68 | tidy -config tidy.conf $$filename; \
|
---|
| 69 | true; \
|
---|
| 70 | /bin/bash obfuscate.sh $$filename; \
|
---|
| 71 | sed -e "s@text/html@application/xhtml+xml@g" \
|
---|
| 72 | -e "s/\xa9/\©/ " \
|
---|
| 73 | -i $$filename; \
|
---|
| 74 | done;
|
---|
[5470c67] | 75 |
|
---|
[77ab7f3] | 76 | $(Q)$(MAKE) --no-print-directory wget-list md5sums
|
---|
[3a4594b] | 77 |
|
---|
[924ab90] | 78 | pdf: validate
|
---|
[0e6d3c0] | 79 | @echo "Generating profiled XML for PDF..."
|
---|
[77ab7f3] | 80 | $(Q)xsltproc --nonet \
|
---|
| 81 | --stringparam profile.condition pdf \
|
---|
| 82 | --output $(RENDERTMP)/lfs-pdf.xml \
|
---|
| 83 | stylesheets/lfs-xsl/profile.xsl \
|
---|
[672ea43] | 84 | $(RENDERTMP)/lfs-full.xml
|
---|
[0e6d3c0] | 85 |
|
---|
| 86 | @echo "Generating FO file..."
|
---|
[77ab7f3] | 87 | $(Q)xsltproc --nonet \
|
---|
[188e34c] | 88 | --stringparam rootid "$(ROOT_ID)" \
|
---|
| 89 | --output $(RENDERTMP)/lfs-pdf.fo \
|
---|
| 90 | stylesheets/lfs-pdf.xsl \
|
---|
| 91 | $(RENDERTMP)/lfs-pdf.xml
|
---|
| 92 |
|
---|
| 93 | $(Q)sed -i -e 's/span="inherit"/span="all"/' $(RENDERTMP)/lfs-pdf.fo
|
---|
| 94 | $(Q)bash pdf-fixups.sh $(RENDERTMP)/lfs-pdf.fo
|
---|
| 95 |
|
---|
| 96 | @echo "Generating PDF file..."
|
---|
[855fda1] | 97 | $(Q)mkdir -p $(RENDERTMP)/images
|
---|
| 98 | $(Q)cp images/*.png $(RENDERTMP)/images
|
---|
[188e34c] | 99 |
|
---|
[855fda1] | 100 | $(Q)mkdir -p $(BASEDIR)
|
---|
[e8a2adc] | 101 |
|
---|
[188e34c] | 102 | $(Q)fop -q $(RENDERTMP)/lfs-pdf.fo $(BASEDIR)/$(PDF_OUTPUT) 2>fop.log
|
---|
| 103 | @echo "$(BASEDIR)/$(PDF_OUTPUT) created"
|
---|
| 104 | @echo "fop.log created"
|
---|
| 105 |
|
---|
[924ab90] | 106 | nochunks: validate profile-html
|
---|
[0e6d3c0] | 107 | @echo "Generating non chunked XHTML file..."
|
---|
[77ab7f3] | 108 | $(Q)xsltproc --nonet \
|
---|
| 109 | --stringparam rootid "$(ROOT_ID)" \
|
---|
| 110 | --output $(BASEDIR)/$(NOCHUNKS_OUTPUT) \
|
---|
| 111 | stylesheets/lfs-nochunks.xsl \
|
---|
[672ea43] | 112 | $(RENDERTMP)/lfs-html.xml
|
---|
[85ce0fca] | 113 | # $(RENDERTMP)/lfs-html2.xml
|
---|
[0e6d3c0] | 114 |
|
---|
| 115 | @echo "Running Tidy..."
|
---|
[05d60ce] | 116 | $(Q)tidy -config tidy.conf $(BASEDIR)/$(NOCHUNKS_OUTPUT) || true
|
---|
[77ab7f3] | 117 |
|
---|
[05d60ce] | 118 | @echo "Running obfuscate.sh..."
|
---|
[22bcbdd] | 119 | $(Q)bash obfuscate.sh $(BASEDIR)/$(NOCHUNKS_OUTPUT)
|
---|
| 120 | $(Q)sed -i -e "s@text/html@application/xhtml+xml@g" $(BASEDIR)/$(NOCHUNKS_OUTPUT)
|
---|
| 121 | $(Q)sed -i -e "s@../wget-list@wget-list@" $(BASEDIR)/$(NOCHUNKS_OUTPUT)
|
---|
[e679f0b] | 122 | $(Q)sed -i -e "s@../md5sums@md5sums@" $(BASEDIR)/$(NOCHUNKS_OUTPUT)
|
---|
[77ab7f3] | 123 | $(Q)sed -i -e "s@\xa9@\©@" $(BASEDIR)/$(NOCHUNKS_OUTPUT)
|
---|
| 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) \
|
---|
| 144 | stylesheets/lfs-xsl/profile.xsl \
|
---|
| 145 | index.xml
|
---|
| 146 |
|
---|
[0e6d3c0] | 147 | @echo "Validating the book..."
|
---|
[77ab7f3] | 148 | $(Q)xmllint --nonet \
|
---|
| 149 | --noent \
|
---|
| 150 | --postvalid \
|
---|
| 151 | -o $(RENDERTMP)/lfs-full.xml \
|
---|
[35a5259] | 152 | $(RENDERTMP)/lfs-html2.xml
|
---|
| 153 |
|
---|
[1c48007] | 154 | $(Q)rm -f appendices/*.script
|
---|
[63f4150] | 155 | $(Q)./aux-file-data.sh $(RENDERTMP)/lfs-full.xml
|
---|
[924ab90] | 156 | @echo "Validation complete."
|
---|
[1c48007] | 157 |
|
---|
[3781c69] | 158 | profile-html:
|
---|
[0e6d3c0] | 159 | @echo "Generating profiled XML for XHTML..."
|
---|
[77ab7f3] | 160 | $(Q)xsltproc --nonet \
|
---|
| 161 | --stringparam profile.condition html \
|
---|
| 162 | --output $(RENDERTMP)/lfs-html.xml \
|
---|
| 163 | stylesheets/lfs-xsl/profile.xsl \
|
---|
[23a0f82] | 164 | $(RENDERTMP)/lfs-full.xml
|
---|
[0e6d3c0] | 165 |
|
---|
[ca22630] | 166 | wget-list: $(BASEDIR)/wget-list $(BASEDIR)/wget-list-$(REV)
|
---|
[77ab7f3] | 167 | $(BASEDIR)/wget-list: stylesheets/wget-list.xsl chapter03/chapter03.xml \
|
---|
[6218cdb] | 168 | packages.ent patches.ent general.ent
|
---|
[6288602] | 169 | @echo "Generating consolidated wget list at $(BASEDIR)/wget-list ..."
|
---|
[05d60ce] | 170 | $(Q)mkdir -p $(BASEDIR)
|
---|
[77ab7f3] | 171 | $(Q)xsltproc --xinclude --nonet \
|
---|
| 172 | --output $(BASEDIR)/wget-list \
|
---|
| 173 | stylesheets/wget-list.xsl \
|
---|
| 174 | chapter03/chapter03.xml
|
---|
| 175 |
|
---|
[ca22630] | 176 | $(BASEDIR)/wget-list-$(REV): stylesheets/wget-list.xsl \
|
---|
| 177 | chapter03/chapter03.xml \
|
---|
| 178 | packages.ent patches.ent general.ent
|
---|
| 179 | $(Q)xsltproc --nonet --xinclude \
|
---|
| 180 | --stringparam profile.revision $(REV) \
|
---|
| 181 | --output $(RENDERTMP)/wget-list.xml \
|
---|
| 182 | stylesheets/lfs-xsl/profile.xsl \
|
---|
| 183 | chapter03/chapter03.xml
|
---|
| 184 | $(Q)xsltproc --xinclude --nonet \
|
---|
| 185 | --output $(BASEDIR)/wget-list-$(REV) \
|
---|
| 186 | stylesheets/wget-list.xsl \
|
---|
| 187 | $(RENDERTMP)/wget-list.xml
|
---|
| 188 |
|
---|
[064222a] | 189 | md5sums: $(BASEDIR)/md5sums
|
---|
[77ab7f3] | 190 | $(BASEDIR)/md5sums: stylesheets/wget-list.xsl chapter03/chapter03.xml \
|
---|
| 191 | packages.ent patches.ent
|
---|
[6288602] | 192 | @echo "Generating consolidated md5sum file at $(BASEDIR)/md5sums ..."
|
---|
[daed5a3] | 193 | $(Q)mkdir -p $(BASEDIR)
|
---|
[77ab7f3] | 194 |
|
---|
[ca22630] | 195 | $(Q)xsltproc --nonet --xinclude \
|
---|
[35a5259] | 196 | --stringparam profile.revision $(REV) \
|
---|
[ca22630] | 197 | --output $(RENDERTMP)/md5sum.xml \
|
---|
[77ab7f3] | 198 | stylesheets/lfs-xsl/profile.xsl \
|
---|
| 199 | chapter03/chapter03.xml
|
---|
| 200 |
|
---|
[ca22630] | 201 | $(Q)xsltproc --xinclude --nonet \
|
---|
[77ab7f3] | 202 | --output $(BASEDIR)/md5sums \
|
---|
| 203 | stylesheets/md5sum.xsl \
|
---|
[ca22630] | 204 | $(RENDERTMP)/md5sum.xml
|
---|
[22bcbdd] | 205 | $(Q)sed -i -e \
|
---|
[43194f0] | 206 | "s/BOOTSCRIPTS-MD5SUM/$(shell md5sum lfs-bootscripts*.tar.xz | cut -d' ' -f1)/" \
|
---|
[22bcbdd] | 207 | $(BASEDIR)/md5sums
|
---|
[daed5a3] | 208 |
|
---|
[59483809] | 209 | version:
|
---|
[4467b18d] | 210 | $(Q)./git-version.sh $(REV)
|
---|
[59483809] | 211 |
|
---|
[f0ba388] | 212 | #dump-commands: validate
|
---|
| 213 | # @echo "Dumping book commands..."
|
---|
[cbd8bf0f] | 214 | # $(Q)xsltproc --nonet \
|
---|
| 215 | # --output $(RENDERTMP)/lfs-html.xml \
|
---|
| 216 | # --stringparam profile.revision $(REV) \
|
---|
| 217 | # stylesheets/lfs-xsl/profile.xsl \
|
---|
| 218 | # $(RENDERTMP)/lfs-full.xml
|
---|
[77ab7f3] | 219 |
|
---|
[f0ba388] | 220 | # $(Q)rm -rf $(DUMPDIR)
|
---|
[77ab7f3] | 221 |
|
---|
[f0ba388] | 222 | # $(Q)xsltproc --output $(DUMPDIR)/ \
|
---|
| 223 | # stylesheets/dump-commands.xsl \
|
---|
| 224 | # $(RENDERTMP)/lfs-html.xml
|
---|
| 225 | # @echo "Dumping book commands complete in $(DUMPDIR)"
|
---|
[77ab7f3] | 226 |
|
---|
[f0ba388] | 227 | all: book nochunks pdf # dump-commands
|
---|
[22bcbdd] | 228 |
|
---|
[59483809] | 229 | .PHONY : all book dump-commands nochunks pdf profile-html tmpdir validate md5sums wget-list version
|
---|
[536b6aa] | 230 |
|
---|