source: Makefile@ 672ea43

10.0 10.0-rc1 10.1 10.1-rc1 11.0 11.0-rc1 11.0-rc2 11.0-rc3 11.1 11.1-rc1 11.2 11.2-rc1 11.3 11.3-rc1 12.0 12.0-rc1 12.1 12.1-rc1 arm bdubbs/gcc13 ml-11.0 multilib renodr/libudev-from-systemd s6-init trunk xry111/arm64 xry111/arm64-12.0 xry111/clfs-ng xry111/lfs-next xry111/loongarch xry111/loongarch-12.0 xry111/loongarch-12.1 xry111/mips64el xry111/pip3 xry111/rust-wip-20221008 xry111/update-glibc
Last change on this file since 672ea43 was 672ea43, checked in by Pierre Labastie <pieere@…>, 4 years ago

Better beter fix for Makefile

git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@11775 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689

  • Property mode set to 100644
File size: 7.1 KB
Line 
1#BASEDIR = ~/lfs-book
2#SYSDDIR = ~/lfs-systemd
3#DUMPDIR = ~/lfs-commands
4RENDERTMP = $(HOME)/tmp
5CHUNK_QUIET = 1
6ROOT_ID =
7SHELL = /bin/bash
8
9ifdef V
10 Q =
11else
12 Q = @
13endif
14
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)
26 BASEDIR ?= ~/lfs-book
27 PDF_OUTPUT ?= LFS-BOOK.pdf
28 NOCHUNKS_OUTPUT ?= LFS-BOOK.html
29 DUMPDIR ?= ~/lfs-commands
30else
31 BASEDIR ?= ~/lfs-systemd
32 PDF_OUTPUT ?= LFS-SYSD-BOOK.pdf
33 NOCHUNKS_OUTPUT ?= LFS-SYSD-BOOK.html
34 DUMPDIR ?= ~/lfs-sysd-commands
35endif
36
37book: validate profile-html
38 @echo "Generating chunked XHTML files at $(BASEDIR)/ ..."
39 $(Q)xsltproc --nonet \
40 --stringparam chunk.quietly $(CHUNK_QUIET) \
41 --stringparam rootid "$(ROOT_ID)" \
42 --stringparam base.dir $(BASEDIR)/ \
43 stylesheets/lfs-chunked.xsl \
44 $(RENDERTMP)/lfs-html.xml
45
46 @echo "Copying CSS code and images..."
47 $(Q)mkdir -p $(BASEDIR)/stylesheets
48 $(Q)cp stylesheets/lfs-xsl/*.css $(BASEDIR)/stylesheets
49 $(Q)pushd $(BASEDIR)/ > /dev/null; \
50 sed -i -e "s@../stylesheets@stylesheets@g" *.html; \
51 popd > /dev/null
52
53 $(Q)mkdir -p $(BASEDIR)/images
54 $(Q)cp images/*.png $(BASEDIR)/images
55
56 @echo "Running Tidy and obfuscate.sh..."
57 $(Q)for filename in `find $(BASEDIR) -name "*.html"`; do \
58 tidy -config tidy.conf $$filename; \
59 true; \
60 /bin/bash obfuscate.sh $$filename; \
61 sed -e "s@text/html@application/xhtml+xml@g" \
62 -e "s/\xa9/\&copy;/ " \
63 -i $$filename; \
64 done;
65
66 $(Q)$(MAKE) --no-print-directory wget-list md5sums
67
68pdf: validate
69 @echo "Generating profiled XML for PDF..."
70 $(Q)xsltproc --nonet \
71 --stringparam profile.condition pdf \
72 --output $(RENDERTMP)/lfs-pdf.xml \
73 stylesheets/lfs-xsl/profile.xsl \
74 $(RENDERTMP)/lfs-full.xml
75
76 @echo "Generating FO file..."
77 $(Q)xsltproc --nonet \
78 --stringparam rootid "$(ROOT_ID)" \
79 --output $(RENDERTMP)/lfs-pdf.fo \
80 stylesheets/lfs-pdf.xsl \
81 $(RENDERTMP)/lfs-pdf.xml
82
83 $(Q)sed -i -e 's/span="inherit"/span="all"/' $(RENDERTMP)/lfs-pdf.fo
84 $(Q)bash pdf-fixups.sh $(RENDERTMP)/lfs-pdf.fo
85
86 @echo "Generating PDF file..."
87 $(Q)mkdir -p $(RENDERTMP)/images
88 $(Q)cp images/*.png $(RENDERTMP)/images
89
90 $(Q)mkdir -p $(BASEDIR)
91
92 $(Q)fop -q $(RENDERTMP)/lfs-pdf.fo $(BASEDIR)/$(PDF_OUTPUT) 2>fop.log
93 @echo "$(BASEDIR)/$(PDF_OUTPUT) created"
94 @echo "fop.log created"
95
96nochunks: validate profile-html
97 @echo "Generating non chunked XHTML file..."
98 $(Q)xsltproc --nonet \
99 --stringparam rootid "$(ROOT_ID)" \
100 --output $(BASEDIR)/$(NOCHUNKS_OUTPUT) \
101 stylesheets/lfs-nochunks.xsl \
102 $(RENDERTMP)/lfs-html.xml
103# $(RENDERTMP)/lfs-html2.xml
104
105 @echo "Running Tidy..."
106 $(Q)tidy -config tidy.conf $(BASEDIR)/$(NOCHUNKS_OUTPUT) || true
107
108 @echo "Running obfuscate.sh..."
109 $(Q)bash obfuscate.sh $(BASEDIR)/$(NOCHUNKS_OUTPUT)
110 $(Q)sed -i -e "s@text/html@application/xhtml+xml@g" $(BASEDIR)/$(NOCHUNKS_OUTPUT)
111 $(Q)sed -i -e "s@../wget-list@wget-list@" $(BASEDIR)/$(NOCHUNKS_OUTPUT)
112 $(Q)sed -i -e "s@../md5sums@md5sums@" $(BASEDIR)/$(NOCHUNKS_OUTPUT)
113 $(Q)sed -i -e "s@\xa9@\&copy;@" $(BASEDIR)/$(NOCHUNKS_OUTPUT)
114
115 @echo "Output at $(BASEDIR)/$(NOCHUNKS_OUTPUT)"
116
117tmpdir:
118 @echo "Creating and cleaning $(RENDERTMP)"
119 $(Q)mkdir -p $(RENDERTMP)
120 $(Q)rm -f $(RENDERTMP)/lfs*.xml
121 $(Q)rm -f $(RENDERTMP)/*wget*
122 $(Q)rm -f $(RENDERTMP)/*md5sum*
123 $(Q)rm -f $(RENDERTMP)/*pdf.fo
124
125validate: tmpdir
126 @echo "Processing bootscripts..."
127 $(Q)bash process-scripts.sh
128
129 @echo "Adjusting for revision $(REV)..."
130 $(Q)xsltproc --nonet \
131 --xinclude \
132 --output $(RENDERTMP)/lfs-html2.xml \
133 --stringparam profile.revision $(REV) \
134 stylesheets/lfs-xsl/profile.xsl \
135 index.xml
136
137 @echo "Validating the book..."
138 $(Q)xmllint --nonet \
139 --noent \
140 --postvalid \
141 -o $(RENDERTMP)/lfs-full.xml \
142 $(RENDERTMP)/lfs-html2.xml
143
144 $(Q)rm -f appendices/*.script
145 $(Q)./aux-file-data.sh $(RENDERTMP)/lfs-full.xml
146 @echo "Validation complete."
147
148profile-html:
149 @echo "Generating profiled XML for XHTML..."
150 $(Q)xsltproc --nonet \
151 --stringparam profile.condition html \
152 --output $(RENDERTMP)/lfs-html.xml \
153 stylesheets/lfs-xsl/profile.xsl \
154 $(RENDERTMP)/lfs-full.xml
155
156wget-list: $(BASEDIR)/wget-list
157$(BASEDIR)/wget-list: stylesheets/wget-list.xsl chapter03/chapter03.xml \
158 packages.ent patches.ent
159 @echo "Generating consolidated wget list at $(BASEDIR)/wget-list ..."
160 $(Q)mkdir -p $(BASEDIR)
161
162# $(Q)xsltproc --nonet --xinclude \
163# --stringparam profile.revision $(REV) \
164# --output $(RENDERTMP)/sysd-wget.xml \
165# stylesheets/lfs-xsl/profile.xsl \
166# chapter03/chapter03.xml
167
168 $(Q)xsltproc --xinclude --nonet \
169 --output $(BASEDIR)/wget-list \
170 stylesheets/wget-list.xsl \
171 chapter03/chapter03.xml
172
173md5sums: $(BASEDIR)/md5sums
174$(BASEDIR)/md5sums: stylesheets/wget-list.xsl chapter03/chapter03.xml \
175 packages.ent patches.ent
176 @echo "Generating consolidated md5sum file at $(BASEDIR)/md5sums ..."
177 $(Q)mkdir -p $(BASEDIR)
178
179 $(Q)xsltproc --nonet --xinclude \
180 --stringparam profile.revision $(REV) \
181 --output $(RENDERTMP)/sysv-md5sum.xml \
182 stylesheets/lfs-xsl/profile.xsl \
183 chapter03/chapter03.xml
184
185 $(Q)xsltproc --xinclude --nonet \
186 --output $(BASEDIR)/md5sums \
187 stylesheets/md5sum.xsl \
188 $(RENDERTMP)/sysv-md5sum.xml
189 $(Q)sed -i -e \
190 "s/BOOTSCRIPTS-MD5SUM/$(shell md5sum lfs-bootscripts*.tar.xz | cut -d' ' -f1)/" \
191 $(BASEDIR)/md5sums
192
193#dump-commands: validate
194# @echo "Dumping book commands..."
195# $(Q)xsltproc --nonet \
196# --output $(RENDERTMP)/lfs-html.xml \
197# --stringparam profile.revision $(REV) \
198# stylesheets/lfs-xsl/profile.xsl \
199# $(RENDERTMP)/lfs-full.xml
200
201# $(Q)rm -rf $(DUMPDIR)
202
203# $(Q)xsltproc --output $(DUMPDIR)/ \
204# stylesheets/dump-commands.xsl \
205# $(RENDERTMP)/lfs-html.xml
206# @echo "Dumping book commands complete in $(DUMPDIR)"
207
208all: book nochunks pdf # dump-commands
209
210.PHONY : all book dump-commands nochunks pdf profile-html tmpdir validate md5sums wget-list
211
Note: See TracBrowser for help on using the repository browser.