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