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