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