[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 |
|
---|
[35a5259] | 38 | book: validate profile-html
|
---|
| 39 | @echo "Generating chunked XHTML files at $(BASEDIR)/ ..."
|
---|
[1118b17] | 40 | $(Q)xsltproc --nonet \
|
---|
| 41 | --stringparam chunk.quietly $(CHUNK_QUIET) \
|
---|
| 42 | --stringparam rootid "$(ROOT_ID)" \
|
---|
| 43 | --stringparam base.dir $(BASEDIR)/ \
|
---|
| 44 | stylesheets/lfs-chunked.xsl \
|
---|
[23a0f82] | 45 | $(RENDERTMP)/lfs-html.xml
|
---|
[287ea55] | 46 |
|
---|
[0e6d3c0] | 47 | @echo "Copying CSS code and images..."
|
---|
[77ab7f3] | 48 | $(Q)mkdir -p $(BASEDIR)/stylesheets
|
---|
[05d60ce] | 49 | $(Q)cp stylesheets/lfs-xsl/*.css $(BASEDIR)/stylesheets
|
---|
[df732b5] | 50 | $(Q)sed -i 's|../stylesheet|stylesheet|' $(BASEDIR)/index.html
|
---|
[1c27a53] | 51 |
|
---|
[77ab7f3] | 52 | $(Q)mkdir -p $(BASEDIR)/images
|
---|
[05d60ce] | 53 | $(Q)cp images/*.png $(BASEDIR)/images
|
---|
[287ea55] | 54 |
|
---|
[05d60ce] | 55 | @echo "Running Tidy and obfuscate.sh..."
|
---|
| 56 | $(Q)for filename in `find $(BASEDIR) -name "*.html"`; do \
|
---|
[77ab7f3] | 57 | tidy -config tidy.conf $$filename; \
|
---|
| 58 | true; \
|
---|
| 59 | /bin/bash obfuscate.sh $$filename; \
|
---|
| 60 | sed -e "s@text/html@application/xhtml+xml@g" \
|
---|
| 61 | -i $$filename; \
|
---|
| 62 | done;
|
---|
[5470c67] | 63 |
|
---|
[77ab7f3] | 64 | $(Q)$(MAKE) --no-print-directory wget-list md5sums
|
---|
[3a4594b] | 65 |
|
---|
[924ab90] | 66 | pdf: validate
|
---|
[0e6d3c0] | 67 | @echo "Generating profiled XML for PDF..."
|
---|
[77ab7f3] | 68 | $(Q)xsltproc --nonet \
|
---|
| 69 | --stringparam profile.condition pdf \
|
---|
| 70 | --output $(RENDERTMP)/lfs-pdf.xml \
|
---|
| 71 | stylesheets/lfs-xsl/profile.xsl \
|
---|
[672ea43] | 72 | $(RENDERTMP)/lfs-full.xml
|
---|
[0e6d3c0] | 73 |
|
---|
| 74 | @echo "Generating FO file..."
|
---|
[77ab7f3] | 75 | $(Q)xsltproc --nonet \
|
---|
[188e34c] | 76 | --stringparam rootid "$(ROOT_ID)" \
|
---|
| 77 | --output $(RENDERTMP)/lfs-pdf.fo \
|
---|
| 78 | stylesheets/lfs-pdf.xsl \
|
---|
| 79 | $(RENDERTMP)/lfs-pdf.xml
|
---|
| 80 |
|
---|
| 81 | $(Q)sed -i -e 's/span="inherit"/span="all"/' $(RENDERTMP)/lfs-pdf.fo
|
---|
| 82 | $(Q)bash pdf-fixups.sh $(RENDERTMP)/lfs-pdf.fo
|
---|
| 83 |
|
---|
| 84 | @echo "Generating PDF file..."
|
---|
[855fda1] | 85 | $(Q)mkdir -p $(RENDERTMP)/images
|
---|
| 86 | $(Q)cp images/*.png $(RENDERTMP)/images
|
---|
[188e34c] | 87 |
|
---|
[855fda1] | 88 | $(Q)mkdir -p $(BASEDIR)
|
---|
[e8a2adc] | 89 |
|
---|
[188e34c] | 90 | $(Q)fop -q $(RENDERTMP)/lfs-pdf.fo $(BASEDIR)/$(PDF_OUTPUT) 2>fop.log
|
---|
| 91 | @echo "$(BASEDIR)/$(PDF_OUTPUT) created"
|
---|
| 92 | @echo "fop.log created"
|
---|
| 93 |
|
---|
[924ab90] | 94 | nochunks: validate profile-html
|
---|
[0e6d3c0] | 95 | @echo "Generating non chunked XHTML file..."
|
---|
[77ab7f3] | 96 | $(Q)xsltproc --nonet \
|
---|
| 97 | --stringparam rootid "$(ROOT_ID)" \
|
---|
| 98 | --output $(BASEDIR)/$(NOCHUNKS_OUTPUT) \
|
---|
| 99 | stylesheets/lfs-nochunks.xsl \
|
---|
[672ea43] | 100 | $(RENDERTMP)/lfs-html.xml
|
---|
[85ce0fca] | 101 | # $(RENDERTMP)/lfs-html2.xml
|
---|
[0e6d3c0] | 102 |
|
---|
| 103 | @echo "Running Tidy..."
|
---|
[05d60ce] | 104 | $(Q)tidy -config tidy.conf $(BASEDIR)/$(NOCHUNKS_OUTPUT) || true
|
---|
[77ab7f3] | 105 |
|
---|
[05d60ce] | 106 | @echo "Running obfuscate.sh..."
|
---|
[22bcbdd] | 107 | $(Q)bash obfuscate.sh $(BASEDIR)/$(NOCHUNKS_OUTPUT)
|
---|
| 108 | $(Q)sed -i -e "s@text/html@application/xhtml+xml@g" $(BASEDIR)/$(NOCHUNKS_OUTPUT)
|
---|
| 109 | $(Q)sed -i -e "s@../wget-list@wget-list@" $(BASEDIR)/$(NOCHUNKS_OUTPUT)
|
---|
[e679f0b] | 110 | $(Q)sed -i -e "s@../md5sums@md5sums@" $(BASEDIR)/$(NOCHUNKS_OUTPUT)
|
---|
[77ab7f3] | 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 |
|
---|
[47bc996] | 153 | DOWNLOADS_DEP = chapter03/packages.xml chapter03/patches.xml \
|
---|
| 154 | packages.ent patches.ent general.ent
|
---|
| 155 |
|
---|
[ca22630] | 156 | wget-list: $(BASEDIR)/wget-list $(BASEDIR)/wget-list-$(REV)
|
---|
[47bc996] | 157 | $(BASEDIR)/wget-list: stylesheets/wget-list.xsl $(DOWNLOADS_DEP)
|
---|
[6288602] | 158 | @echo "Generating consolidated wget list at $(BASEDIR)/wget-list ..."
|
---|
[05d60ce] | 159 | $(Q)mkdir -p $(BASEDIR)
|
---|
[77ab7f3] | 160 | $(Q)xsltproc --xinclude --nonet \
|
---|
| 161 | --output $(BASEDIR)/wget-list \
|
---|
[99260fe] | 162 | stylesheets/wget-list.xsl \
|
---|
[77ab7f3] | 163 | chapter03/chapter03.xml
|
---|
| 164 |
|
---|
[47bc996] | 165 | $(BASEDIR)/wget-list-$(REV): stylesheets/wget-list.xsl $(DOWNLOADS_DEP)
|
---|
[ca22630] | 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
|
---|
[47bc996] | 177 | $(BASEDIR)/md5sums: stylesheets/wget-list.xsl $(DOWNLOADS_DEP)
|
---|
[6288602] | 178 | @echo "Generating consolidated md5sum file at $(BASEDIR)/md5sums ..."
|
---|
[daed5a3] | 179 | $(Q)mkdir -p $(BASEDIR)
|
---|
[77ab7f3] | 180 |
|
---|
[ca22630] | 181 | $(Q)xsltproc --nonet --xinclude \
|
---|
[35a5259] | 182 | --stringparam profile.revision $(REV) \
|
---|
[ca22630] | 183 | --output $(RENDERTMP)/md5sum.xml \
|
---|
[77ab7f3] | 184 | stylesheets/lfs-xsl/profile.xsl \
|
---|
| 185 | chapter03/chapter03.xml
|
---|
| 186 |
|
---|
[ca22630] | 187 | $(Q)xsltproc --xinclude --nonet \
|
---|
[77ab7f3] | 188 | --output $(BASEDIR)/md5sums \
|
---|
| 189 | stylesheets/md5sum.xsl \
|
---|
[ca22630] | 190 | $(RENDERTMP)/md5sum.xml
|
---|
[22bcbdd] | 191 | $(Q)sed -i -e \
|
---|
[43194f0] | 192 | "s/BOOTSCRIPTS-MD5SUM/$(shell md5sum lfs-bootscripts*.tar.xz | cut -d' ' -f1)/" \
|
---|
[22bcbdd] | 193 | $(BASEDIR)/md5sums
|
---|
[daed5a3] | 194 |
|
---|
[59483809] | 195 | version:
|
---|
[4467b18d] | 196 | $(Q)./git-version.sh $(REV)
|
---|
[59483809] | 197 |
|
---|
[cdc6053] | 198 | dump-commands: validate
|
---|
| 199 | @echo "Dumping book commands..."
|
---|
[77ab7f3] | 200 |
|
---|
[cdc6053] | 201 | $(Q)rm -rf $(DUMPDIR)
|
---|
[77ab7f3] | 202 |
|
---|
[cdc6053] | 203 | $(Q)xsltproc --output $(DUMPDIR)/ \
|
---|
| 204 | stylesheets/dump-commands.xsl \
|
---|
| 205 | $(RENDERTMP)/lfs-full.xml
|
---|
| 206 | @echo "Dumping book commands complete in $(DUMPDIR)"
|
---|
[77ab7f3] | 207 |
|
---|
[cdc6053] | 208 | all: book nochunks pdf dump-commands
|
---|
[22bcbdd] | 209 |
|
---|
[c858ba4e] | 210 | dist:
|
---|
| 211 | $(Q)DIST=/tmp/LFS-RELEASE ./git-version.sh $(REV)
|
---|
| 212 | $(Q)rm -f lfs-$$(</tmp/LFS-RELEASE).tar.xz
|
---|
| 213 | $(Q)tar cJf lfs-$$(</tmp/LFS-RELEASE).tar.xz \
|
---|
| 214 | $(shell git ls-tree HEAD . --name-only) version.ent \
|
---|
| 215 | -C /tmp LFS-RELEASE \
|
---|
| 216 | --transform "s,^,lfs-$$(</tmp/LFS-RELEASE)/,"
|
---|
| 217 | $(Q)echo "Generated XML tarball lfs-$$(</tmp/LFS-RELEASE).tar.xz"
|
---|
| 218 |
|
---|
| 219 | .PHONY : all book dump-commands nochunks pdf profile-html tmpdir validate md5sums wget-list version dist
|
---|
[536b6aa] | 220 |
|
---|