[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
|
---|
[37e35d2] | 29 | DUMPDIR ?= ~/cross-lfs-commands
|
---|
[1fa2099] | 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 |
|
---|
| 63 | $(Q)mkdir -p $(BASEDIR)/images
|
---|
| 64 | $(Q)cp images/*.png $(BASEDIR)/images
|
---|
| 65 |
|
---|
| 66 | @echo "Running Tidy and obfuscate.sh..."
|
---|
| 67 | $(Q)for filename in `find $(BASEDIR) -name "*.html"`; do \
|
---|
| 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;
|
---|
| 75 |
|
---|
| 76 | $(Q)$(MAKE) --no-print-directory wget-list md5sums
|
---|
| 77 |
|
---|
| 78 | pdf: validate
|
---|
| 79 | @echo "Generating profiled XML for PDF..."
|
---|
| 80 | $(Q)xsltproc --nonet \
|
---|
| 81 | --stringparam profile.condition pdf \
|
---|
| 82 | --output $(RENDERTMP)/lfs-pdf.xml \
|
---|
| 83 | stylesheets/lfs-xsl/profile.xsl \
|
---|
| 84 | $(RENDERTMP)/lfs-full.xml
|
---|
| 85 |
|
---|
| 86 | @echo "Generating FO file..."
|
---|
| 87 | $(Q)xsltproc --nonet \
|
---|
| 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..."
|
---|
| 97 | $(Q)mkdir -p $(RENDERTMP)/images
|
---|
| 98 | $(Q)cp images/*.png $(RENDERTMP)/images
|
---|
| 99 |
|
---|
| 100 | $(Q)mkdir -p $(BASEDIR)
|
---|
| 101 |
|
---|
| 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 |
|
---|
| 106 | nochunks: validate profile-html
|
---|
| 107 | @echo "Generating non chunked XHTML file..."
|
---|
| 108 | $(Q)xsltproc --nonet \
|
---|
| 109 | --stringparam rootid "$(ROOT_ID)" \
|
---|
| 110 | --output $(BASEDIR)/$(NOCHUNKS_OUTPUT) \
|
---|
| 111 | stylesheets/lfs-nochunks.xsl \
|
---|
[0efb8e1] | 112 | $(RENDERTMP)/lfs-html.xml
|
---|
| 113 | # $(RENDERTMP)/lfs-html2.xml
|
---|
[1fa2099] | 114 |
|
---|
| 115 | @echo "Running Tidy..."
|
---|
| 116 | $(Q)tidy -config tidy.conf $(BASEDIR)/$(NOCHUNKS_OUTPUT) || true
|
---|
| 117 |
|
---|
| 118 | @echo "Running obfuscate.sh..."
|
---|
| 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)
|
---|
| 122 | $(Q)sed -i -e "s@../md5sums@md5sums@" $(BASEDIR)/$(NOCHUNKS_OUTPUT)
|
---|
| 123 | $(Q)sed -i -e "s@\xa9@\©@" $(BASEDIR)/$(NOCHUNKS_OUTPUT)
|
---|
| 124 |
|
---|
| 125 | @echo "Output at $(BASEDIR)/$(NOCHUNKS_OUTPUT)"
|
---|
| 126 |
|
---|
| 127 | tmpdir:
|
---|
| 128 | @echo "Creating and cleaning $(RENDERTMP)"
|
---|
| 129 | $(Q)mkdir -p $(RENDERTMP)
|
---|
| 130 | $(Q)rm -f $(RENDERTMP)/lfs*.xml
|
---|
| 131 | $(Q)rm -f $(RENDERTMP)/*wget*
|
---|
| 132 | $(Q)rm -f $(RENDERTMP)/*md5sum*
|
---|
| 133 | $(Q)rm -f $(RENDERTMP)/*pdf.fo
|
---|
| 134 |
|
---|
| 135 | validate: tmpdir
|
---|
| 136 | @echo "Processing bootscripts..."
|
---|
| 137 | $(Q)bash process-scripts.sh
|
---|
| 138 |
|
---|
| 139 | @echo "Adjusting for revision $(REV)..."
|
---|
| 140 | $(Q)xsltproc --nonet \
|
---|
| 141 | --xinclude \
|
---|
| 142 | --output $(RENDERTMP)/lfs-html2.xml \
|
---|
| 143 | --stringparam profile.revision $(REV) \
|
---|
[8eb3fe4] | 144 | --stringparam profile.arch $(ARCH) \
|
---|
[1fa2099] | 145 | stylesheets/lfs-xsl/profile.xsl \
|
---|
| 146 | index.xml
|
---|
| 147 |
|
---|
| 148 | @echo "Validating the book..."
|
---|
| 149 | $(Q)xmllint --nonet \
|
---|
| 150 | --noent \
|
---|
| 151 | --postvalid \
|
---|
| 152 | -o $(RENDERTMP)/lfs-full.xml \
|
---|
| 153 | $(RENDERTMP)/lfs-html2.xml
|
---|
| 154 |
|
---|
| 155 | $(Q)rm -f appendices/*.script
|
---|
| 156 | $(Q)./aux-file-data.sh $(RENDERTMP)/lfs-full.xml
|
---|
| 157 | @echo "Validation complete."
|
---|
| 158 |
|
---|
| 159 | profile-html:
|
---|
| 160 | @echo "Generating profiled XML for XHTML..."
|
---|
| 161 | $(Q)xsltproc --nonet \
|
---|
| 162 | --stringparam profile.condition html \
|
---|
| 163 | --output $(RENDERTMP)/lfs-html.xml \
|
---|
| 164 | stylesheets/lfs-xsl/profile.xsl \
|
---|
| 165 | $(RENDERTMP)/lfs-full.xml
|
---|
| 166 |
|
---|
| 167 | wget-list: $(BASEDIR)/wget-list
|
---|
| 168 | $(BASEDIR)/wget-list: stylesheets/wget-list.xsl chapter03/chapter03.xml \
|
---|
| 169 | packages.ent patches.ent
|
---|
| 170 | @echo "Generating consolidated wget list at $(BASEDIR)/wget-list ..."
|
---|
| 171 | $(Q)mkdir -p $(BASEDIR)
|
---|
| 172 |
|
---|
| 173 | # $(Q)xsltproc --nonet --xinclude \
|
---|
| 174 | # --stringparam profile.revision $(REV) \
|
---|
| 175 | # --output $(RENDERTMP)/sysd-wget.xml \
|
---|
| 176 | # stylesheets/lfs-xsl/profile.xsl \
|
---|
| 177 | # chapter03/chapter03.xml
|
---|
| 178 |
|
---|
| 179 | $(Q)xsltproc --xinclude --nonet \
|
---|
| 180 | --output $(BASEDIR)/wget-list \
|
---|
| 181 | stylesheets/wget-list.xsl \
|
---|
| 182 | chapter03/chapter03.xml
|
---|
| 183 |
|
---|
| 184 | md5sums: $(BASEDIR)/md5sums
|
---|
| 185 | $(BASEDIR)/md5sums: stylesheets/wget-list.xsl chapter03/chapter03.xml \
|
---|
| 186 | packages.ent patches.ent
|
---|
| 187 | @echo "Generating consolidated md5sum file at $(BASEDIR)/md5sums ..."
|
---|
| 188 | $(Q)mkdir -p $(BASEDIR)
|
---|
| 189 |
|
---|
| 190 | $(Q)xsltproc --nonet --xinclude \
|
---|
| 191 | --stringparam profile.revision $(REV) \
|
---|
[37e35d2] | 192 | --stringparam profile.arch $(ARCH) \
|
---|
[1fa2099] | 193 | --output $(RENDERTMP)/sysv-md5sum.xml \
|
---|
| 194 | stylesheets/lfs-xsl/profile.xsl \
|
---|
| 195 | chapter03/chapter03.xml
|
---|
| 196 |
|
---|
| 197 | $(Q)xsltproc --xinclude --nonet \
|
---|
| 198 | --output $(BASEDIR)/md5sums \
|
---|
| 199 | stylesheets/md5sum.xsl \
|
---|
| 200 | $(RENDERTMP)/sysv-md5sum.xml
|
---|
| 201 | $(Q)sed -i -e \
|
---|
[5839010] | 202 | "s/BOOTSCRIPTS-MD5SUM/$(shell md5sum lfs-bootscripts*.tar.xz | cut -d' ' -f1)/" \
|
---|
[1fa2099] | 203 | $(BASEDIR)/md5sums
|
---|
| 204 |
|
---|
| 205 | #dump-commands: validate
|
---|
| 206 | # @echo "Dumping book commands..."
|
---|
| 207 | # $(Q)xsltproc --nonet \
|
---|
| 208 | # --output $(RENDERTMP)/lfs-html.xml \
|
---|
| 209 | # --stringparam profile.revision $(REV) \
|
---|
| 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 |
|
---|