[1fa2099] | 1 | #BASEDIR = ~/lfs-book
|
---|
| 2 | #SYSDDIR = ~/lfs-systemd
|
---|
| 3 | #DUMPDIR = ~/lfs-commands
|
---|
| 4 | RENDERTMP = $(HOME)/tmp
|
---|
| 5 | CHUNK_QUIET = 1
|
---|
| 6 | ROOT_ID =
|
---|
| 7 | SHELL = /bin/bash
|
---|
| 8 |
|
---|
| 9 | ifdef V
|
---|
| 10 | Q =
|
---|
| 11 | else
|
---|
| 12 | Q = @
|
---|
| 13 | endif
|
---|
| 14 |
|
---|
| 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)
|
---|
| 26 | BASEDIR ?= ~/lfs-book
|
---|
| 27 | PDF_OUTPUT ?= LFS-BOOK.pdf
|
---|
| 28 | NOCHUNKS_OUTPUT ?= LFS-BOOK.html
|
---|
| 29 | DUMPDIR ?= ~/lfs-commands
|
---|
| 30 | else
|
---|
| 31 | BASEDIR ?= ~/lfs-systemd
|
---|
| 32 | PDF_OUTPUT ?= LFS-SYSD-BOOK.pdf
|
---|
| 33 | NOCHUNKS_OUTPUT ?= LFS-SYSD-BOOK.html
|
---|
| 34 | DUMPDIR ?= ~/lfs-sysd-commands
|
---|
| 35 | endif
|
---|
| 36 |
|
---|
[8eb3fe4] | 37 | ifndef ARCH
|
---|
| 38 | ARCH = default
|
---|
| 39 | endif
|
---|
| 40 | ifneq ($(ARCH), default)
|
---|
[ee1a413] | 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
|
---|
[8eb3fe4] | 47 | endif
|
---|
| 48 | endif
|
---|
| 49 |
|
---|
[1fa2099] | 50 | book: validate profile-html
|
---|
| 51 | @echo "Generating chunked XHTML files at $(BASEDIR)/ ..."
|
---|
| 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 \
|
---|
| 57 | $(RENDERTMP)/lfs-html.xml
|
---|
| 58 |
|
---|
| 59 | @echo "Copying CSS code and images..."
|
---|
| 60 | $(Q)mkdir -p $(BASEDIR)/stylesheets
|
---|
| 61 | $(Q)cp stylesheets/lfs-xsl/*.css $(BASEDIR)/stylesheets
|
---|
| 62 | $(Q)pushd $(BASEDIR)/ > /dev/null; \
|
---|
| 63 | sed -i -e "s@../stylesheets@stylesheets@g" *.html; \
|
---|
| 64 | popd > /dev/null
|
---|
| 65 |
|
---|
| 66 | $(Q)mkdir -p $(BASEDIR)/images
|
---|
| 67 | $(Q)cp images/*.png $(BASEDIR)/images
|
---|
| 68 |
|
---|
| 69 | @echo "Running Tidy and obfuscate.sh..."
|
---|
| 70 | $(Q)for filename in `find $(BASEDIR) -name "*.html"`; do \
|
---|
| 71 | tidy -config tidy.conf $$filename; \
|
---|
| 72 | true; \
|
---|
| 73 | /bin/bash obfuscate.sh $$filename; \
|
---|
| 74 | sed -e "s@text/html@application/xhtml+xml@g" \
|
---|
| 75 | -e "s/\xa9/\©/ " \
|
---|
| 76 | -i $$filename; \
|
---|
| 77 | done;
|
---|
| 78 |
|
---|
| 79 | $(Q)$(MAKE) --no-print-directory wget-list md5sums
|
---|
| 80 |
|
---|
| 81 | pdf: validate
|
---|
| 82 | @echo "Generating profiled XML for PDF..."
|
---|
| 83 | $(Q)xsltproc --nonet \
|
---|
| 84 | --stringparam profile.condition pdf \
|
---|
| 85 | --output $(RENDERTMP)/lfs-pdf.xml \
|
---|
| 86 | stylesheets/lfs-xsl/profile.xsl \
|
---|
| 87 | $(RENDERTMP)/lfs-full.xml
|
---|
| 88 |
|
---|
| 89 | @echo "Generating FO file..."
|
---|
| 90 | $(Q)xsltproc --nonet \
|
---|
| 91 | --stringparam rootid "$(ROOT_ID)" \
|
---|
| 92 | --output $(RENDERTMP)/lfs-pdf.fo \
|
---|
| 93 | stylesheets/lfs-pdf.xsl \
|
---|
| 94 | $(RENDERTMP)/lfs-pdf.xml
|
---|
| 95 |
|
---|
| 96 | $(Q)sed -i -e 's/span="inherit"/span="all"/' $(RENDERTMP)/lfs-pdf.fo
|
---|
| 97 | $(Q)bash pdf-fixups.sh $(RENDERTMP)/lfs-pdf.fo
|
---|
| 98 |
|
---|
| 99 | @echo "Generating PDF file..."
|
---|
| 100 | $(Q)mkdir -p $(RENDERTMP)/images
|
---|
| 101 | $(Q)cp images/*.png $(RENDERTMP)/images
|
---|
| 102 |
|
---|
| 103 | $(Q)mkdir -p $(BASEDIR)
|
---|
| 104 |
|
---|
| 105 | $(Q)fop -q $(RENDERTMP)/lfs-pdf.fo $(BASEDIR)/$(PDF_OUTPUT) 2>fop.log
|
---|
| 106 | @echo "$(BASEDIR)/$(PDF_OUTPUT) created"
|
---|
| 107 | @echo "fop.log created"
|
---|
| 108 |
|
---|
| 109 | nochunks: validate profile-html
|
---|
| 110 | @echo "Generating non chunked XHTML file..."
|
---|
| 111 | $(Q)xsltproc --nonet \
|
---|
| 112 | --stringparam rootid "$(ROOT_ID)" \
|
---|
| 113 | --output $(BASEDIR)/$(NOCHUNKS_OUTPUT) \
|
---|
| 114 | stylesheets/lfs-nochunks.xsl \
|
---|
| 115 | $(RENDERTMP)/lfs-html2.xml
|
---|
| 116 |
|
---|
| 117 | @echo "Running Tidy..."
|
---|
| 118 | $(Q)tidy -config tidy.conf $(BASEDIR)/$(NOCHUNKS_OUTPUT) || true
|
---|
| 119 |
|
---|
| 120 | @echo "Running obfuscate.sh..."
|
---|
| 121 | $(Q)bash obfuscate.sh $(BASEDIR)/$(NOCHUNKS_OUTPUT)
|
---|
| 122 | $(Q)sed -i -e "s@text/html@application/xhtml+xml@g" $(BASEDIR)/$(NOCHUNKS_OUTPUT)
|
---|
| 123 | $(Q)sed -i -e "s@../wget-list@wget-list@" $(BASEDIR)/$(NOCHUNKS_OUTPUT)
|
---|
| 124 | $(Q)sed -i -e "s@../md5sums@md5sums@" $(BASEDIR)/$(NOCHUNKS_OUTPUT)
|
---|
| 125 | $(Q)sed -i -e "s@\xa9@\©@" $(BASEDIR)/$(NOCHUNKS_OUTPUT)
|
---|
| 126 |
|
---|
| 127 | @echo "Output at $(BASEDIR)/$(NOCHUNKS_OUTPUT)"
|
---|
| 128 |
|
---|
| 129 | tmpdir:
|
---|
| 130 | @echo "Creating and cleaning $(RENDERTMP)"
|
---|
| 131 | $(Q)mkdir -p $(RENDERTMP)
|
---|
| 132 | $(Q)rm -f $(RENDERTMP)/lfs*.xml
|
---|
| 133 | $(Q)rm -f $(RENDERTMP)/*wget*
|
---|
| 134 | $(Q)rm -f $(RENDERTMP)/*md5sum*
|
---|
| 135 | $(Q)rm -f $(RENDERTMP)/*pdf.fo
|
---|
| 136 |
|
---|
| 137 | validate: tmpdir
|
---|
| 138 | @echo "Processing bootscripts..."
|
---|
| 139 | $(Q)bash process-scripts.sh
|
---|
| 140 |
|
---|
| 141 | @echo "Adjusting for revision $(REV)..."
|
---|
| 142 | $(Q)xsltproc --nonet \
|
---|
| 143 | --xinclude \
|
---|
| 144 | --output $(RENDERTMP)/lfs-html2.xml \
|
---|
| 145 | --stringparam profile.revision $(REV) \
|
---|
[8eb3fe4] | 146 | --stringparam profile.arch $(ARCH) \
|
---|
[1fa2099] | 147 | stylesheets/lfs-xsl/profile.xsl \
|
---|
| 148 | index.xml
|
---|
| 149 |
|
---|
| 150 | @echo "Validating the book..."
|
---|
| 151 | $(Q)xmllint --nonet \
|
---|
| 152 | --noent \
|
---|
| 153 | --postvalid \
|
---|
| 154 | -o $(RENDERTMP)/lfs-full.xml \
|
---|
| 155 | $(RENDERTMP)/lfs-html2.xml
|
---|
| 156 |
|
---|
| 157 | $(Q)rm -f appendices/*.script
|
---|
| 158 | $(Q)./aux-file-data.sh $(RENDERTMP)/lfs-full.xml
|
---|
| 159 | @echo "Validation complete."
|
---|
| 160 |
|
---|
| 161 | profile-html:
|
---|
| 162 | @echo "Generating profiled XML for XHTML..."
|
---|
| 163 | $(Q)xsltproc --nonet \
|
---|
| 164 | --stringparam profile.condition html \
|
---|
| 165 | --output $(RENDERTMP)/lfs-html.xml \
|
---|
| 166 | stylesheets/lfs-xsl/profile.xsl \
|
---|
| 167 | $(RENDERTMP)/lfs-full.xml
|
---|
| 168 |
|
---|
| 169 | wget-list: $(BASEDIR)/wget-list
|
---|
| 170 | $(BASEDIR)/wget-list: stylesheets/wget-list.xsl chapter03/chapter03.xml \
|
---|
| 171 | packages.ent patches.ent
|
---|
| 172 | @echo "Generating consolidated wget list at $(BASEDIR)/wget-list ..."
|
---|
| 173 | $(Q)mkdir -p $(BASEDIR)
|
---|
| 174 |
|
---|
| 175 | # $(Q)xsltproc --nonet --xinclude \
|
---|
| 176 | # --stringparam profile.revision $(REV) \
|
---|
[8eb3fe4] | 177 | # --stringparam profile.arch $(ARCH) \
|
---|
[1fa2099] | 178 | # --output $(RENDERTMP)/sysd-wget.xml \
|
---|
| 179 | # stylesheets/lfs-xsl/profile.xsl \
|
---|
| 180 | # chapter03/chapter03.xml
|
---|
| 181 |
|
---|
| 182 | $(Q)xsltproc --xinclude --nonet \
|
---|
| 183 | --output $(BASEDIR)/wget-list \
|
---|
| 184 | stylesheets/wget-list.xsl \
|
---|
| 185 | chapter03/chapter03.xml
|
---|
| 186 |
|
---|
| 187 | md5sums: $(BASEDIR)/md5sums
|
---|
| 188 | $(BASEDIR)/md5sums: stylesheets/wget-list.xsl chapter03/chapter03.xml \
|
---|
| 189 | packages.ent patches.ent
|
---|
| 190 | @echo "Generating consolidated md5sum file at $(BASEDIR)/md5sums ..."
|
---|
| 191 | $(Q)mkdir -p $(BASEDIR)
|
---|
| 192 |
|
---|
| 193 | $(Q)xsltproc --nonet --xinclude \
|
---|
| 194 | --stringparam profile.revision $(REV) \
|
---|
[8eb3fe4] | 195 | --stringparam profile.arch $(ARCH) \
|
---|
[1fa2099] | 196 | --output $(RENDERTMP)/sysv-md5sum.xml \
|
---|
| 197 | stylesheets/lfs-xsl/profile.xsl \
|
---|
| 198 | chapter03/chapter03.xml
|
---|
| 199 |
|
---|
| 200 | $(Q)xsltproc --xinclude --nonet \
|
---|
| 201 | --output $(BASEDIR)/md5sums \
|
---|
| 202 | stylesheets/md5sum.xsl \
|
---|
| 203 | $(RENDERTMP)/sysv-md5sum.xml
|
---|
| 204 | $(Q)sed -i -e \
|
---|
[5839010] | 205 | "s/BOOTSCRIPTS-MD5SUM/$(shell md5sum lfs-bootscripts*.tar.xz | cut -d' ' -f1)/" \
|
---|
[1fa2099] | 206 | $(BASEDIR)/md5sums
|
---|
| 207 |
|
---|
| 208 | #dump-commands: validate
|
---|
| 209 | # @echo "Dumping book commands..."
|
---|
| 210 | # $(Q)xsltproc --nonet \
|
---|
| 211 | # --output $(RENDERTMP)/lfs-html.xml \
|
---|
| 212 | # --stringparam profile.revision $(REV) \
|
---|
[8eb3fe4] | 213 | # --stringparam profile.arch $(ARCH) \
|
---|
[1fa2099] | 214 | # stylesheets/lfs-xsl/profile.xsl \
|
---|
| 215 | # $(RENDERTMP)/lfs-full.xml
|
---|
| 216 |
|
---|
| 217 | # $(Q)rm -rf $(DUMPDIR)
|
---|
| 218 |
|
---|
| 219 | # $(Q)xsltproc --output $(DUMPDIR)/ \
|
---|
| 220 | # stylesheets/dump-commands.xsl \
|
---|
| 221 | # $(RENDERTMP)/lfs-html.xml
|
---|
| 222 | # @echo "Dumping book commands complete in $(DUMPDIR)"
|
---|
| 223 |
|
---|
| 224 | all: book nochunks pdf # dump-commands
|
---|
| 225 |
|
---|
| 226 | .PHONY : all book dump-commands nochunks pdf profile-html tmpdir validate md5sums wget-list
|
---|
| 227 |
|
---|