source: Makefile@ ac340c2

ml-11.0 multilib
Last change on this file since ac340c2 was b2c61c6, checked in by Xℹ Ruoyao <xry111@…>, 3 years ago

MultiLib: Merge changes from trunk

git-svn-id: http://svn.linuxfromscratch.org/LFS/branches/multilib@11630 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689

  • Property mode set to 100644
File size: 7.6 KB
RevLine 
[35a5259]1#BASEDIR = ~/lfs-book
2#SYSDDIR = ~/lfs-systemd
3#DUMPDIR = ~/lfs-commands
[7d39455]4RENDERTMP = $(HOME)/tmp
5CHUNK_QUIET = 1
6ROOT_ID =
[5fde2f94]7SHELL = /bin/bash
[3a4594b]8
[05d60ce]9ifdef V
10 Q =
11else
12 Q = @
13endif
14
[35a5259]15ifndef REV
16 REV = sysv
17endif
18
19ifneq ($(REV), sysv)
20 ifneq ($(REV), systemd)
21 $(error REV must be 'sysv' (default) or 'systemd'.)
22 endif
23endif
24
25ifeq ($(REV), sysv)
[1aff37f]26 BASEDIR ?= ~/lfs-book
27 PDF_OUTPUT ?= LFS-BOOK.pdf
28 NOCHUNKS_OUTPUT ?= LFS-BOOK.html
29 DUMPDIR ?= ~/lfs-commands
[35a5259]30else
[1aff37f]31 BASEDIR ?= ~/lfs-systemd
32 PDF_OUTPUT ?= LFS-SYSD-BOOK.pdf
33 NOCHUNKS_OUTPUT ?= LFS-SYSD-BOOK.html
34 DUMPDIR ?= ~/lfs-sysd-commands
[35a5259]35endif
[1118b17]36
[b3f1ebb3]37ifndef ARCH
38 ARCH = default
39endif
40ifneq ($(ARCH), default)
[fd48baa]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
[b3f1ebb3]47 endif
48endif
49
[35a5259]50book: validate profile-html
51 @echo "Generating chunked XHTML files at $(BASEDIR)/ ..."
[1118b17]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 \
[23a0f82]57 $(RENDERTMP)/lfs-html.xml
[287ea55]58
[0e6d3c0]59 @echo "Copying CSS code and images..."
[77ab7f3]60 $(Q)mkdir -p $(BASEDIR)/stylesheets
[05d60ce]61 $(Q)cp stylesheets/lfs-xsl/*.css $(BASEDIR)/stylesheets
[77ab7f3]62 $(Q)pushd $(BASEDIR)/ > /dev/null; \
63 sed -i -e "s@../stylesheets@stylesheets@g" *.html; \
64 popd > /dev/null
[1c27a53]65
[77ab7f3]66 $(Q)mkdir -p $(BASEDIR)/images
[05d60ce]67 $(Q)cp images/*.png $(BASEDIR)/images
[287ea55]68
[05d60ce]69 @echo "Running Tidy and obfuscate.sh..."
70 $(Q)for filename in `find $(BASEDIR) -name "*.html"`; do \
[77ab7f3]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/\&copy;/ " \
76 -i $$filename; \
77 done;
[5470c67]78
[77ab7f3]79 $(Q)$(MAKE) --no-print-directory wget-list md5sums
[3a4594b]80
[924ab90]81pdf: validate
[0e6d3c0]82 @echo "Generating profiled XML for PDF..."
[77ab7f3]83 $(Q)xsltproc --nonet \
84 --stringparam profile.condition pdf \
85 --output $(RENDERTMP)/lfs-pdf.xml \
86 stylesheets/lfs-xsl/profile.xsl \
[855fda1]87 $(RENDERTMP)/lfs-full.xml
[0e6d3c0]88
89 @echo "Generating FO file..."
[77ab7f3]90 $(Q)xsltproc --nonet \
[188e34c]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..."
[855fda1]100 $(Q)mkdir -p $(RENDERTMP)/images
101 $(Q)cp images/*.png $(RENDERTMP)/images
[188e34c]102
[855fda1]103 $(Q)mkdir -p $(BASEDIR)
[e8a2adc]104
[188e34c]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
[924ab90]109nochunks: validate profile-html
[0e6d3c0]110 @echo "Generating non chunked XHTML file..."
[77ab7f3]111 $(Q)xsltproc --nonet \
112 --stringparam rootid "$(ROOT_ID)" \
113 --output $(BASEDIR)/$(NOCHUNKS_OUTPUT) \
114 stylesheets/lfs-nochunks.xsl \
115 $(RENDERTMP)/lfs-html2.xml
[0e6d3c0]116
117 @echo "Running Tidy..."
[05d60ce]118 $(Q)tidy -config tidy.conf $(BASEDIR)/$(NOCHUNKS_OUTPUT) || true
[77ab7f3]119
[05d60ce]120 @echo "Running obfuscate.sh..."
[22bcbdd]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)
[e679f0b]124 $(Q)sed -i -e "s@../md5sums@md5sums@" $(BASEDIR)/$(NOCHUNKS_OUTPUT)
[77ab7f3]125 $(Q)sed -i -e "s@\xa9@\&copy;@" $(BASEDIR)/$(NOCHUNKS_OUTPUT)
126
127 @echo "Output at $(BASEDIR)/$(NOCHUNKS_OUTPUT)"
128
[106dc42]129tmpdir:
130 @echo "Creating and cleaning $(RENDERTMP)"
[77ab7f3]131 $(Q)mkdir -p $(RENDERTMP)
132 $(Q)rm -f $(RENDERTMP)/lfs*.xml
[35a5259]133 $(Q)rm -f $(RENDERTMP)/*wget*
134 $(Q)rm -f $(RENDERTMP)/*md5sum*
[77ab7f3]135 $(Q)rm -f $(RENDERTMP)/*pdf.fo
[106dc42]136
[924ab90]137validate: tmpdir
[1c48007]138 @echo "Processing bootscripts..."
[6d13ffb]139 $(Q)bash process-scripts.sh
[35a5259]140
141 @echo "Adjusting for revision $(REV)..."
142 $(Q)xsltproc --nonet \
143 --xinclude \
144 --output $(RENDERTMP)/lfs-html2.xml \
145 --stringparam profile.revision $(REV) \
[b3f1ebb3]146 --stringparam profile.arch $(ARCH) \
[35a5259]147 stylesheets/lfs-xsl/profile.xsl \
148 index.xml
149
[0e6d3c0]150 @echo "Validating the book..."
[77ab7f3]151 $(Q)xmllint --nonet \
152 --noent \
153 --postvalid \
154 -o $(RENDERTMP)/lfs-full.xml \
[35a5259]155 $(RENDERTMP)/lfs-html2.xml
156
[1c48007]157 $(Q)rm -f appendices/*.script
[63f4150]158 $(Q)./aux-file-data.sh $(RENDERTMP)/lfs-full.xml
[924ab90]159 @echo "Validation complete."
[1c48007]160
[1118b17]161profile-html:
[0e6d3c0]162 @echo "Generating profiled XML for XHTML..."
[77ab7f3]163 $(Q)xsltproc --nonet \
164 --stringparam profile.condition html \
165 --output $(RENDERTMP)/lfs-html.xml \
166 stylesheets/lfs-xsl/profile.xsl \
[23a0f82]167 $(RENDERTMP)/lfs-full.xml
[0e6d3c0]168
[064222a]169wget-list: $(BASEDIR)/wget-list
[77ab7f3]170$(BASEDIR)/wget-list: stylesheets/wget-list.xsl chapter03/chapter03.xml \
171 packages.ent patches.ent
[6288602]172 @echo "Generating consolidated wget list at $(BASEDIR)/wget-list ..."
[05d60ce]173 $(Q)mkdir -p $(BASEDIR)
[77ab7f3]174
[d4407c7]175# $(Q)xsltproc --nonet --xinclude \
176# --stringparam profile.revision $(REV) \
[b3f1ebb3]177# --stringparam profile.arch $(ARCH) \
[d4407c7]178# --output $(RENDERTMP)/sysd-wget.xml \
179# stylesheets/lfs-xsl/profile.xsl \
180# chapter03/chapter03.xml
[77ab7f3]181
182 $(Q)xsltproc --xinclude --nonet \
183 --output $(BASEDIR)/wget-list \
184 stylesheets/wget-list.xsl \
185 chapter03/chapter03.xml
186
[064222a]187md5sums: $(BASEDIR)/md5sums
[77ab7f3]188$(BASEDIR)/md5sums: stylesheets/wget-list.xsl chapter03/chapter03.xml \
189 packages.ent patches.ent
[6288602]190 @echo "Generating consolidated md5sum file at $(BASEDIR)/md5sums ..."
[daed5a3]191 $(Q)mkdir -p $(BASEDIR)
[77ab7f3]192
193 $(Q)xsltproc --nonet --xinclude \
[35a5259]194 --stringparam profile.revision $(REV) \
[b3f1ebb3]195 --stringparam profile.arch $(ARCH) \
[77ab7f3]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
[22bcbdd]204 $(Q)sed -i -e \
[b2c61c6]205 "s/BOOTSCRIPTS-MD5SUM/$(shell md5sum lfs-bootscripts*.tar.xz | cut -d' ' -f1)/" \
[22bcbdd]206 $(BASEDIR)/md5sums
[daed5a3]207
[f0ba388]208#dump-commands: validate
209# @echo "Dumping book commands..."
[cbd8bf0f]210# $(Q)xsltproc --nonet \
211# --output $(RENDERTMP)/lfs-html.xml \
212# --stringparam profile.revision $(REV) \
[b3f1ebb3]213# --stringparam profile.arch $(ARCH) \
[cbd8bf0f]214# stylesheets/lfs-xsl/profile.xsl \
215# $(RENDERTMP)/lfs-full.xml
[77ab7f3]216
[f0ba388]217# $(Q)rm -rf $(DUMPDIR)
[77ab7f3]218
[f0ba388]219# $(Q)xsltproc --output $(DUMPDIR)/ \
220# stylesheets/dump-commands.xsl \
221# $(RENDERTMP)/lfs-html.xml
222# @echo "Dumping book commands complete in $(DUMPDIR)"
[77ab7f3]223
[f0ba388]224all: book nochunks pdf # dump-commands
[22bcbdd]225
[35a5259]226.PHONY : all book dump-commands nochunks pdf profile-html tmpdir validate md5sums wget-list
[536b6aa]227
Note: See TracBrowser for help on using the repository browser.