source: Makefile@ c5a1240

multilib trunk xry111/arm64 xry111/loongarch
Last change on this file since c5a1240 was b6dd23c7, checked in by Pierre Labastie <pierre.labastie@…>, 5 months ago

Makefile: improvements in xsltproc commands

  • remove some useless --xinclude
  • write only one option per line
  • use --encode UTF-8 instead of --noent (which is useless after profiling anyway
  • try to be consistent in option order
  • use --output instead of -o
  • Property mode set to 100644
File size: 7.4 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
[35a5259]35book: validate profile-html
36 @echo "Generating chunked XHTML files at $(BASEDIR)/ ..."
[1118b17]37 $(Q)xsltproc --nonet \
38 --stringparam chunk.quietly $(CHUNK_QUIET) \
39 --stringparam rootid "$(ROOT_ID)" \
40 --stringparam base.dir $(BASEDIR)/ \
41 stylesheets/lfs-chunked.xsl \
[23a0f82]42 $(RENDERTMP)/lfs-html.xml
[287ea55]43
[0e6d3c0]44 @echo "Copying CSS code and images..."
[77ab7f3]45 $(Q)mkdir -p $(BASEDIR)/stylesheets
[05d60ce]46 $(Q)cp stylesheets/lfs-xsl/*.css $(BASEDIR)/stylesheets
[4ac089b5]47 $(Q)sed -e 's|../stylesheet|stylesheet|' \
48 -i $(BASEDIR)/index.html
[1c27a53]49
[77ab7f3]50 $(Q)mkdir -p $(BASEDIR)/images
[05d60ce]51 $(Q)cp images/*.png $(BASEDIR)/images
[287ea55]52
[05d60ce]53 @echo "Running Tidy and obfuscate.sh..."
54 $(Q)for filename in `find $(BASEDIR) -name "*.html"`; do \
[77ab7f3]55 tidy -config tidy.conf $$filename; \
56 /bin/bash obfuscate.sh $$filename; \
[4ac089b5]57 sed -e "s|text/html|application/xhtml+xml|g" \
[77ab7f3]58 -i $$filename; \
[4ac089b5]59 done
[5470c67]60
[77ab7f3]61 $(Q)$(MAKE) --no-print-directory wget-list md5sums
[3a4594b]62
[924ab90]63pdf: validate
[0e6d3c0]64 @echo "Generating profiled XML for PDF..."
[77ab7f3]65 $(Q)xsltproc --nonet \
66 --stringparam profile.condition pdf \
67 --output $(RENDERTMP)/lfs-pdf.xml \
68 stylesheets/lfs-xsl/profile.xsl \
[672ea43]69 $(RENDERTMP)/lfs-full.xml
[0e6d3c0]70
71 @echo "Generating FO file..."
[77ab7f3]72 $(Q)xsltproc --nonet \
[188e34c]73 --stringparam rootid "$(ROOT_ID)" \
74 --output $(RENDERTMP)/lfs-pdf.fo \
75 stylesheets/lfs-pdf.xsl \
76 $(RENDERTMP)/lfs-pdf.xml
77
78 $(Q)sed -i -e 's/span="inherit"/span="all"/' $(RENDERTMP)/lfs-pdf.fo
79 $(Q)bash pdf-fixups.sh $(RENDERTMP)/lfs-pdf.fo
80
81 @echo "Generating PDF file..."
[855fda1]82 $(Q)mkdir -p $(RENDERTMP)/images
83 $(Q)cp images/*.png $(RENDERTMP)/images
[188e34c]84
[855fda1]85 $(Q)mkdir -p $(BASEDIR)
[e8a2adc]86
[188e34c]87 $(Q)fop -q $(RENDERTMP)/lfs-pdf.fo $(BASEDIR)/$(PDF_OUTPUT) 2>fop.log
88 @echo "$(BASEDIR)/$(PDF_OUTPUT) created"
89 @echo "fop.log created"
90
[924ab90]91nochunks: validate profile-html
[0e6d3c0]92 @echo "Generating non chunked XHTML file..."
[77ab7f3]93 $(Q)xsltproc --nonet \
94 --stringparam rootid "$(ROOT_ID)" \
95 --output $(BASEDIR)/$(NOCHUNKS_OUTPUT) \
96 stylesheets/lfs-nochunks.xsl \
[672ea43]97 $(RENDERTMP)/lfs-html.xml
[0e6d3c0]98
99 @echo "Running Tidy..."
[16d0182]100 $(Q)tidy -config tidy.conf $(BASEDIR)/$(NOCHUNKS_OUTPUT) || test $$? -le 1
[77ab7f3]101
[05d60ce]102 @echo "Running obfuscate.sh..."
[4ac089b5]103 $(Q)bash obfuscate.sh $(BASEDIR)/$(NOCHUNKS_OUTPUT)
104 $(Q)sed -e "s|text/html|application/xhtml+xml|g" \
105 -e "s|../wget-list|wget-list|" \
106 -e "s|../md5sums|md5sums|" \
107 -i $(BASEDIR)/$(NOCHUNKS_OUTPUT)
[77ab7f3]108
109 @echo "Output at $(BASEDIR)/$(NOCHUNKS_OUTPUT)"
110
[106dc42]111tmpdir:
112 @echo "Creating and cleaning $(RENDERTMP)"
[77ab7f3]113 $(Q)mkdir -p $(RENDERTMP)
114 $(Q)rm -f $(RENDERTMP)/lfs*.xml
[35a5259]115 $(Q)rm -f $(RENDERTMP)/*wget*
116 $(Q)rm -f $(RENDERTMP)/*md5sum*
[77ab7f3]117 $(Q)rm -f $(RENDERTMP)/*pdf.fo
[106dc42]118
[59483809]119validate: tmpdir version
[1c48007]120 @echo "Processing bootscripts..."
[6d13ffb]121 $(Q)bash process-scripts.sh
[35a5259]122
123 @echo "Adjusting for revision $(REV)..."
124 $(Q)xsltproc --nonet \
125 --xinclude \
126 --stringparam profile.revision $(REV) \
[b6dd23c7]127 --output $(RENDERTMP)/lfs-html2.xml \
[35a5259]128 stylesheets/lfs-xsl/profile.xsl \
129 index.xml
130
[0e6d3c0]131 @echo "Validating the book..."
[b6dd23c7]132 $(Q)xmllint --nonet \
133 --encode UTF-8 \
134 --postvalid \
135 --output $(RENDERTMP)/lfs-full.xml \
[35a5259]136 $(RENDERTMP)/lfs-html2.xml
137
[1c48007]138 $(Q)rm -f appendices/*.script
[63f4150]139 $(Q)./aux-file-data.sh $(RENDERTMP)/lfs-full.xml
[924ab90]140 @echo "Validation complete."
[1c48007]141
[3781c69]142profile-html:
[0e6d3c0]143 @echo "Generating profiled XML for XHTML..."
[77ab7f3]144 $(Q)xsltproc --nonet \
145 --stringparam profile.condition html \
[99260fe]146 --output $(RENDERTMP)/lfs-html.xml \
[77ab7f3]147 stylesheets/lfs-xsl/profile.xsl \
[99260fe]148 $(RENDERTMP)/lfs-full.xml
[0e6d3c0]149
[47bc996]150DOWNLOADS_DEP = chapter03/packages.xml chapter03/patches.xml \
151 packages.ent patches.ent general.ent
152
[ca22630]153wget-list: $(BASEDIR)/wget-list $(BASEDIR)/wget-list-$(REV)
[47bc996]154$(BASEDIR)/wget-list: stylesheets/wget-list.xsl $(DOWNLOADS_DEP)
[6288602]155 @echo "Generating consolidated wget list at $(BASEDIR)/wget-list ..."
[05d60ce]156 $(Q)mkdir -p $(BASEDIR)
[b6dd23c7]157 $(Q)xsltproc --nonet \
158 --xinclude \
[77ab7f3]159 --output $(BASEDIR)/wget-list \
[99260fe]160 stylesheets/wget-list.xsl \
[77ab7f3]161 chapter03/chapter03.xml
162
[47bc996]163$(BASEDIR)/wget-list-$(REV): stylesheets/wget-list.xsl $(DOWNLOADS_DEP)
[b6dd23c7]164 $(Q)xsltproc --nonet \
165 --xinclude \
[ca22630]166 --stringparam profile.revision $(REV) \
167 --output $(RENDERTMP)/wget-list.xml \
168 stylesheets/lfs-xsl/profile.xsl \
169 chapter03/chapter03.xml
[b6dd23c7]170
171 $(Q)xsltproc --nonet \
[ca22630]172 --output $(BASEDIR)/wget-list-$(REV) \
173 stylesheets/wget-list.xsl \
174 $(RENDERTMP)/wget-list.xml
175
[064222a]176md5sums: $(BASEDIR)/md5sums
[47bc996]177$(BASEDIR)/md5sums: stylesheets/wget-list.xsl $(DOWNLOADS_DEP)
[6288602]178 @echo "Generating consolidated md5sum file at $(BASEDIR)/md5sums ..."
[daed5a3]179 $(Q)mkdir -p $(BASEDIR)
[77ab7f3]180
[b6dd23c7]181 $(Q)xsltproc --nonet \
182 --xinclude \
[35a5259]183 --stringparam profile.revision $(REV) \
[ca22630]184 --output $(RENDERTMP)/md5sum.xml \
[77ab7f3]185 stylesheets/lfs-xsl/profile.xsl \
186 chapter03/chapter03.xml
187
[b6dd23c7]188 $(Q)xsltproc --nonet \
[77ab7f3]189 --output $(BASEDIR)/md5sums \
190 stylesheets/md5sum.xsl \
[ca22630]191 $(RENDERTMP)/md5sum.xml
[22bcbdd]192 $(Q)sed -i -e \
[43194f0]193 "s/BOOTSCRIPTS-MD5SUM/$(shell md5sum lfs-bootscripts*.tar.xz | cut -d' ' -f1)/" \
[22bcbdd]194 $(BASEDIR)/md5sums
[daed5a3]195
[59483809]196version:
[4467b18d]197 $(Q)./git-version.sh $(REV)
[59483809]198
[cdc6053]199dump-commands: validate
200 @echo "Dumping book commands..."
[77ab7f3]201
[cdc6053]202 $(Q)rm -rf $(DUMPDIR)
[77ab7f3]203
[cdc6053]204 $(Q)xsltproc --output $(DUMPDIR)/ \
205 stylesheets/dump-commands.xsl \
206 $(RENDERTMP)/lfs-full.xml
207 @echo "Dumping book commands complete in $(DUMPDIR)"
[77ab7f3]208
[cdc6053]209all: book nochunks pdf dump-commands
[22bcbdd]210
[c858ba4e]211dist:
212 $(Q)DIST=/tmp/LFS-RELEASE ./git-version.sh $(REV)
213 $(Q)rm -f lfs-$$(</tmp/LFS-RELEASE).tar.xz
214 $(Q)tar cJf lfs-$$(</tmp/LFS-RELEASE).tar.xz \
215 $(shell git ls-tree HEAD . --name-only) version.ent \
216 -C /tmp LFS-RELEASE \
217 --transform "s,^,lfs-$$(</tmp/LFS-RELEASE)/,"
218 $(Q)echo "Generated XML tarball lfs-$$(</tmp/LFS-RELEASE).tar.xz"
219
220.PHONY : all book dump-commands nochunks pdf profile-html tmpdir validate md5sums wget-list version dist
[536b6aa]221
Note: See TracBrowser for help on using the repository browser.