source: Makefile@ 5c47955

multilib
Last change on this file since 5c47955 was 8ccf082a, checked in by Thomas Trepl <thomas@…>, 5 months ago

Automatic merge of trunk into multilib

  • Property mode set to 100644
File size: 7.8 KB
RevLine 
[ec18a38]1# vim:ts=3
[7d39455]2RENDERTMP = $(HOME)/tmp
3CHUNK_QUIET = 1
4ROOT_ID =
[5fde2f94]5SHELL = /bin/bash
[3a4594b]6
[05d60ce]7ifdef V
8 Q =
9else
10 Q = @
11endif
12
[35a5259]13ifndef REV
14 REV = sysv
15endif
16
17ifneq ($(REV), sysv)
18 ifneq ($(REV), systemd)
19 $(error REV must be 'sysv' (default) or 'systemd'.)
20 endif
21endif
22
23ifeq ($(REV), sysv)
[0d80918a]24 BASEDIR ?= $(HOME)/public_html/lfs-book
[1aff37f]25 PDF_OUTPUT ?= LFS-BOOK.pdf
26 NOCHUNKS_OUTPUT ?= LFS-BOOK.html
[0d80918a]27 DUMPDIR ?= $(HOME)/lfs-commands
[35a5259]28else
[0d80918a]29 BASEDIR ?= $(HOME)/public_html/lfs-systemd
[1aff37f]30 PDF_OUTPUT ?= LFS-SYSD-BOOK.pdf
31 NOCHUNKS_OUTPUT ?= LFS-SYSD-BOOK.html
[0d80918a]32 DUMPDIR ?= $(HOME)/lfs-sysd-commands
[35a5259]33endif
[1118b17]34
[b3f1ebb3]35ifndef ARCH
36 ARCH = default
37endif
38ifneq ($(ARCH), default)
[fd48baa]39 ifneq ($(ARCH), ml_32)
40 ifneq ($(ARCH), ml_x32)
41 ifneq ($(ARCH), ml_all)
42 $(error ARCH must be either 'default' (default if unset), 'ml_32', 'ml_x32' or 'ml_all'.)
43 endif
44 endif
[b3f1ebb3]45 endif
46endif
47
[35a5259]48book: validate profile-html
49 @echo "Generating chunked XHTML files at $(BASEDIR)/ ..."
[1118b17]50 $(Q)xsltproc --nonet \
51 --stringparam chunk.quietly $(CHUNK_QUIET) \
52 --stringparam rootid "$(ROOT_ID)" \
53 --stringparam base.dir $(BASEDIR)/ \
54 stylesheets/lfs-chunked.xsl \
[23a0f82]55 $(RENDERTMP)/lfs-html.xml
[287ea55]56
[0e6d3c0]57 @echo "Copying CSS code and images..."
[77ab7f3]58 $(Q)mkdir -p $(BASEDIR)/stylesheets
[05d60ce]59 $(Q)cp stylesheets/lfs-xsl/*.css $(BASEDIR)/stylesheets
[4ac089b5]60 $(Q)sed -e 's|../stylesheet|stylesheet|' \
61 -i $(BASEDIR)/index.html
[1c27a53]62
[77ab7f3]63 $(Q)mkdir -p $(BASEDIR)/images
[05d60ce]64 $(Q)cp images/*.png $(BASEDIR)/images
[287ea55]65
[05d60ce]66 @echo "Running Tidy and obfuscate.sh..."
67 $(Q)for filename in `find $(BASEDIR) -name "*.html"`; do \
[77ab7f3]68 tidy -config tidy.conf $$filename; \
69 /bin/bash obfuscate.sh $$filename; \
[4ac089b5]70 sed -e "s|text/html|application/xhtml+xml|g" \
[77ab7f3]71 -i $$filename; \
[4ac089b5]72 done
[5470c67]73
[77ab7f3]74 $(Q)$(MAKE) --no-print-directory wget-list md5sums
[3a4594b]75
[924ab90]76pdf: validate
[0e6d3c0]77 @echo "Generating profiled XML for PDF..."
[77ab7f3]78 $(Q)xsltproc --nonet \
79 --stringparam profile.condition pdf \
80 --output $(RENDERTMP)/lfs-pdf.xml \
81 stylesheets/lfs-xsl/profile.xsl \
[855fda1]82 $(RENDERTMP)/lfs-full.xml
[0e6d3c0]83
84 @echo "Generating FO file..."
[77ab7f3]85 $(Q)xsltproc --nonet \
[188e34c]86 --stringparam rootid "$(ROOT_ID)" \
87 --output $(RENDERTMP)/lfs-pdf.fo \
88 stylesheets/lfs-pdf.xsl \
89 $(RENDERTMP)/lfs-pdf.xml
90
91 $(Q)sed -i -e 's/span="inherit"/span="all"/' $(RENDERTMP)/lfs-pdf.fo
92 $(Q)bash pdf-fixups.sh $(RENDERTMP)/lfs-pdf.fo
93
94 @echo "Generating PDF file..."
[855fda1]95 $(Q)mkdir -p $(RENDERTMP)/images
96 $(Q)cp images/*.png $(RENDERTMP)/images
[188e34c]97
[855fda1]98 $(Q)mkdir -p $(BASEDIR)
[e8a2adc]99
[188e34c]100 $(Q)fop -q $(RENDERTMP)/lfs-pdf.fo $(BASEDIR)/$(PDF_OUTPUT) 2>fop.log
101 @echo "$(BASEDIR)/$(PDF_OUTPUT) created"
102 @echo "fop.log created"
103
[924ab90]104nochunks: validate profile-html
[0e6d3c0]105 @echo "Generating non chunked XHTML file..."
[77ab7f3]106 $(Q)xsltproc --nonet \
107 --stringparam rootid "$(ROOT_ID)" \
108 --output $(BASEDIR)/$(NOCHUNKS_OUTPUT) \
109 stylesheets/lfs-nochunks.xsl \
[c7e74d6]110 $(RENDERTMP)/lfs-html.xml
[0e6d3c0]111
112 @echo "Running Tidy..."
[16d0182]113 $(Q)tidy -config tidy.conf $(BASEDIR)/$(NOCHUNKS_OUTPUT) || test $$? -le 1
[77ab7f3]114
[05d60ce]115 @echo "Running obfuscate.sh..."
[4ac089b5]116 $(Q)bash obfuscate.sh $(BASEDIR)/$(NOCHUNKS_OUTPUT)
117 $(Q)sed -e "s|text/html|application/xhtml+xml|g" \
118 -e "s|../wget-list|wget-list|" \
119 -e "s|../md5sums|md5sums|" \
120 -i $(BASEDIR)/$(NOCHUNKS_OUTPUT)
[77ab7f3]121
122 @echo "Output at $(BASEDIR)/$(NOCHUNKS_OUTPUT)"
123
[106dc42]124tmpdir:
125 @echo "Creating and cleaning $(RENDERTMP)"
[77ab7f3]126 $(Q)mkdir -p $(RENDERTMP)
127 $(Q)rm -f $(RENDERTMP)/lfs*.xml
[35a5259]128 $(Q)rm -f $(RENDERTMP)/*wget*
129 $(Q)rm -f $(RENDERTMP)/*md5sum*
[77ab7f3]130 $(Q)rm -f $(RENDERTMP)/*pdf.fo
[106dc42]131
[59483809]132validate: tmpdir version
[1c48007]133 @echo "Processing bootscripts..."
[6d13ffb]134 $(Q)bash process-scripts.sh
[35a5259]135
136 @echo "Adjusting for revision $(REV)..."
137 $(Q)xsltproc --nonet \
138 --xinclude \
139 --stringparam profile.revision $(REV) \
[b3f1ebb3]140 --stringparam profile.arch $(ARCH) \
[b6dd23c7]141 --output $(RENDERTMP)/lfs-html2.xml \
[35a5259]142 stylesheets/lfs-xsl/profile.xsl \
143 index.xml
144
[0e6d3c0]145 @echo "Validating the book..."
[b6dd23c7]146 $(Q)xmllint --nonet \
147 --encode UTF-8 \
148 --postvalid \
149 --output $(RENDERTMP)/lfs-full.xml \
[35a5259]150 $(RENDERTMP)/lfs-html2.xml
151
[1c48007]152 $(Q)rm -f appendices/*.script
[63f4150]153 $(Q)./aux-file-data.sh $(RENDERTMP)/lfs-full.xml
[924ab90]154 @echo "Validation complete."
[1c48007]155
[3781c69]156profile-html:
[0e6d3c0]157 @echo "Generating profiled XML for XHTML..."
[77ab7f3]158 $(Q)xsltproc --nonet \
159 --stringparam profile.condition html \
[99260fe]160 --output $(RENDERTMP)/lfs-html.xml \
[77ab7f3]161 stylesheets/lfs-xsl/profile.xsl \
[99260fe]162 $(RENDERTMP)/lfs-full.xml
[0e6d3c0]163
[47bc996]164DOWNLOADS_DEP = chapter03/packages.xml chapter03/patches.xml \
165 packages.ent patches.ent general.ent
166
[ca22630]167wget-list: $(BASEDIR)/wget-list $(BASEDIR)/wget-list-$(REV)
[47bc996]168$(BASEDIR)/wget-list: stylesheets/wget-list.xsl $(DOWNLOADS_DEP)
[6288602]169 @echo "Generating consolidated wget list at $(BASEDIR)/wget-list ..."
[05d60ce]170 $(Q)mkdir -p $(BASEDIR)
[b6dd23c7]171 $(Q)xsltproc --nonet \
172 --xinclude \
[77ab7f3]173 --output $(BASEDIR)/wget-list \
[99260fe]174 stylesheets/wget-list.xsl \
[77ab7f3]175 chapter03/chapter03.xml
176
[47bc996]177$(BASEDIR)/wget-list-$(REV): stylesheets/wget-list.xsl $(DOWNLOADS_DEP)
[b6dd23c7]178 $(Q)xsltproc --nonet \
179 --xinclude \
[ca22630]180 --stringparam profile.revision $(REV) \
181 --output $(RENDERTMP)/wget-list.xml \
182 stylesheets/lfs-xsl/profile.xsl \
183 chapter03/chapter03.xml
[b6dd23c7]184
185 $(Q)xsltproc --nonet \
[ca22630]186 --output $(BASEDIR)/wget-list-$(REV) \
187 stylesheets/wget-list.xsl \
188 $(RENDERTMP)/wget-list.xml
189
[064222a]190md5sums: $(BASEDIR)/md5sums
[47bc996]191$(BASEDIR)/md5sums: stylesheets/wget-list.xsl $(DOWNLOADS_DEP)
[6288602]192 @echo "Generating consolidated md5sum file at $(BASEDIR)/md5sums ..."
[daed5a3]193 $(Q)mkdir -p $(BASEDIR)
[77ab7f3]194
[b6dd23c7]195 $(Q)xsltproc --nonet \
196 --xinclude \
[35a5259]197 --stringparam profile.revision $(REV) \
[6dfcfecc]198 --stringparam profile.arch $(ARCH) \
[ca22630]199 --output $(RENDERTMP)/md5sum.xml \
[77ab7f3]200 stylesheets/lfs-xsl/profile.xsl \
201 chapter03/chapter03.xml
202
[b6dd23c7]203 $(Q)xsltproc --nonet \
[77ab7f3]204 --output $(BASEDIR)/md5sums \
205 stylesheets/md5sum.xsl \
[ca22630]206 $(RENDERTMP)/md5sum.xml
[22bcbdd]207 $(Q)sed -i -e \
[b2c61c6]208 "s/BOOTSCRIPTS-MD5SUM/$(shell md5sum lfs-bootscripts*.tar.xz | cut -d' ' -f1)/" \
[22bcbdd]209 $(BASEDIR)/md5sums
[daed5a3]210
[59483809]211version:
[4467b18d]212 $(Q)./git-version.sh $(REV)
[59483809]213
[cdc6053]214dump-commands: validate
215 @echo "Dumping book commands..."
[77ab7f3]216
[cdc6053]217 $(Q)rm -rf $(DUMPDIR)
[77ab7f3]218
[cdc6053]219 $(Q)xsltproc --output $(DUMPDIR)/ \
220 stylesheets/dump-commands.xsl \
221 $(RENDERTMP)/lfs-full.xml
222 @echo "Dumping book commands complete in $(DUMPDIR)"
[77ab7f3]223
[cdc6053]224all: book nochunks pdf dump-commands
[22bcbdd]225
[c858ba4e]226dist:
227 $(Q)DIST=/tmp/LFS-RELEASE ./git-version.sh $(REV)
228 $(Q)rm -f lfs-$$(</tmp/LFS-RELEASE).tar.xz
229 $(Q)tar cJf lfs-$$(</tmp/LFS-RELEASE).tar.xz \
230 $(shell git ls-tree HEAD . --name-only) version.ent \
231 -C /tmp LFS-RELEASE \
232 --transform "s,^,lfs-$$(</tmp/LFS-RELEASE)/,"
233 $(Q)echo "Generated XML tarball lfs-$$(</tmp/LFS-RELEASE).tar.xz"
234
235.PHONY : all book dump-commands nochunks pdf profile-html tmpdir validate md5sums wget-list version dist
[536b6aa]236
Note: See TracBrowser for help on using the repository browser.