source: BOOK/Makefile@ 23f3ab6

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since 23f3ab6 was 5644a7f, checked in by Chris Staub <chris@…>, 15 years ago

obfuscate.sh requires bash

  • Property mode set to 100644
File size: 6.8 KB
RevLine 
[157ab39]1BASEDIR := ~/cross-lfs-book
2DUMPDIR := ~/cross-lfs-commands
3DLLISTDIR := ~/cross-lfs-dllist
[fd5c672]4RENDERTMP := $(HOME)/tmp
[157ab39]5CHUNK_QUIET := 1
[fd5c672]6ROOT_ID :=
[157ab39]7
8S := -
9
[d258427]10ARCHS := x86 x86_64 x86_64-64 sparc sparc64 sparc64-64 mips mips64 mips64-64 \
11 ppc ppc64 alpha native native64
[157ab39]12
13ARCHS_HTML := $(ARCHS:%=%$(S)html)
14ARCHS_NOCHUNKS := $(ARCHS:%=%$(S)nochunks)
15ARCHS_PDF := $(ARCHS:%=%$(S)pdf)
16ARCHS_VALIDATE := $(ARCHS:%=%$(S)validate)
17ARCHS_TROUBLE := $(ARCHS:%=%$(S)trouble)
18ARCHS_DUMP := $(ARCHS:%=%$(S)dump)
19ARCHS_DLLIST := $(ARCHS:%=%$(S)dllist)
[3f8be484]20
[fd5c672]21ifdef V
22 Q =
23else
24 Q = @
25endif
26
27.PHONY: lfs tidy render titlepage $(ARCHS_HTML) nochunks $(ARCHS_NOCHUNKS) pdf \
28 $(ARCHS_PDF) validate $(ARCHS_VALIDATE) trouble $(ARCHS_TROUBLE) \
29 dump-commands $(ARCHS_DUMP) download-list $(ARCHS_DLLIST) tmpdir
[3f8be484]30
[fd5c672]31lfs: tmpdir render tidy
32
33tmpdir:
34 @echo "Creating and cleaning $(RENDERTMP)"
35 $(Q)[ -d $(RENDERTMP) ] || mkdir -p $(RENDERTMP)
36 $(Q)rm -f $(RENDERTMP)/*-{full,html,pdf}.xml
37 $(Q)rm -f $(RENDERTMP)/*.fo
[157ab39]38
39ifeq ($(shell which tidy >/dev/null 2>&1 && echo yes),yes)
40tidy:
[fd5c672]41 @echo "Running tidy on the created HTML"
42 $(Q)for filename in `find $(BASEDIR) -name "*.html"`; do \
43 tidy -config $(PWD)/tidy.conf $$filename; \
[3f8be484]44 true; \
[5644a7f]45 bash $(PWD)/obfuscate.sh $$filename; \
[3f8be484]46 sed -i -e "s@text/html@application/xhtml+xml@g" $$filename; \
47 done;
[157ab39]48else
49tidy:
[fd5c672]50 @echo "Tidy is not installed on this system"
[157ab39]51endif
52
53render: $(ARCHS_HTML) titlepage
54
55titlepage:
[fd5c672]56 $(Q)xsltproc --nonet --output $(BASEDIR)/index.html \
57 $(PWD)/stylesheets/top-index.xsl $(PWD)/index.xml
[3f8be484]58
[157ab39]59$(ARCHS_HTML): override html_arch = $(@:%$(S)html=%)
60$(ARCHS_HTML):
[fd5c672]61 @echo "Validating $(html_arch) book..."
62 $(Q)xmllint --nonet --noent --xinclude --postvalid \
63 -o $(RENDERTMP)/$(html_arch)-full.xml $(PWD)/$(html_arch)-index.xml
64
65 @echo "Generating profiled $(html_arch) book for XHTML..."
66 $(Q)xsltproc --nonet --stringparam profile.condition html \
67 --output $(RENDERTMP)/$(html_arch)-html.xml \
68 $(PWD)/stylesheets/lfs-xsl/profile.xsl $(RENDERTMP)/$(html_arch)-full.xml
69
70 @echo "Rendering chunked XHTML of $(html_arch)..."
71 $(Q)mkdir -p $(BASEDIR)/$(html_arch)
72 $(Q)xsltproc --nonet -stringparam chunk.quietly $(CHUNK_QUIET) \
73 -stringparam rootid "$(ROOT_ID)" \
74 -stringparam base.dir $(BASEDIR)/$(html_arch)/ \
75 $(PWD)/stylesheets/clfs-chunked.xsl $(RENDERTMP)/$(html_arch)-html.xml
76
77 @echo "Copying CSS code and images..."
78 $(Q)mkdir -p $(BASEDIR)/$(html_arch)/stylesheets
79 $(Q)cp $(PWD)/stylesheets/lfs-xsl/*.css $(BASEDIR)/$(html_arch)/stylesheets
80 $(Q)sed -i -e "s@../stylesheets@stylesheets@g" $(BASEDIR)/$(html_arch)/*.html
81 $(Q)mkdir -p $(BASEDIR)/$(html_arch)/images
82 $(Q)cp $(PWD)/images/*.png $(BASEDIR)/$(html_arch)/images
83 $(Q)sed -i -e "s@../images@images@g" $(BASEDIR)/$(html_arch)/*.html
[80040d4]84 $(Q)$(MAKE) ARCHS=$(html_arch) DLLISTDIR=$(BASEDIR) download-list
[fd5c672]85
86nochunks: tmpdir $(ARCHS_NOCHUNKS) tidy
[157ab39]87
88$(ARCHS_NOCHUNKS): override nochunk_arch = $(@:%$(S)nochunks=%)
89$(ARCHS_NOCHUNKS):
[fd5c672]90 @echo "Validating $(nochunk_arch) book..."
91 $(Q)xmllint --nonet --noent --xinclude --postvalid \
92 -o $(RENDERTMP)/$(nochunk_arch)-full.xml $(PWD)/$(nochunk_arch)-index.xml
93
94 @echo "Generating profiled $(nochunk_arch) book for XHTML..."
95 $(Q)xsltproc --nonet --stringparam profile.condition html \
96 --output $(RENDERTMP)/$(nochunk_arch)-html.xml \
97 $(PWD)/stylesheets/lfs-xsl/profile.xsl \
98 $(RENDERTMP)/$(nochunk_arch)-full.xml
99
[157ab39]100 @echo "Rendering Single File HTML of $(nochunk_arch)..."
[fd5c672]101 $(Q)mkdir -p $(BASEDIR)
102 $(Q)xsltproc --nonet -stringparam rootid "$(ROOT_ID)" \
103 --output $(BASEDIR)/CLFS-$(nochunk_arch).html \
104 $(PWD)/stylesheets/clfs-nochunks.xsl $(RENDERTMP)/$(nochunk_arch)-html.xml
105
106 @echo "Running Tidy..."
107 $(Q)tidy -config $(PWD)/tidy.conf $(BASEDIR)/CLFS-$(nochunk_arch).html || true
108 @echo "Running obfuscate.sh..."
[5644a7f]109 $(Q)bash $(PWD)/obfuscate.sh $(BASEDIR)/CLFS-$(nochunk_arch).html
[fd5c672]110 $(Q)sed -i -e "s@text/html@application/xhtml+xml@g" \
111 $(BASEDIR)/CLFS-$(nochunk_arch).html
[157ab39]112
[fd5c672]113pdf: tmpdir $(ARCHS_PDF)
[157ab39]114
115$(ARCHS_PDF): override pdf_arch = $(@:%$(S)pdf=%)
116$(ARCHS_PDF):
[fd5c672]117 @echo "Validating $(pdf_arch) book..."
118 $(Q)xmllint --nonet --noent --xinclude --postvalid \
119 -o $(RENDERTMP)/$(pdf_arch)-full.xml $(PWD)/$(pdf_arch)-index.xml
120
121 @echo "Generating profiled $(pdf_arch) book for PDF..."
122 $(Q)xsltproc --nonet --stringparam profile.condition pdf \
123 --output $(RENDERTMP)/$(pdf_arch)-pdf.xml \
124 $(PWD)/stylesheets/lfs-xsl/profile.xsl \
125 $(RENDERTMP)/$(pdf_arch)-full.xml
126
127 @echo "Generating FO file of $(pdf_arch)..."
128 $(Q)xsltproc --nonet -stringparam rootid "$(ROOT_ID)" \
129 --output $(RENDERTMP)/$(pdf_arch).fo $(PWD)/stylesheets/clfs-pdf.xsl \
130 $(RENDERTMP)/$(pdf_arch)-pdf.xml
131 $(Q)sed -i -e 's/span="inherit"/span="all"/' $(RENDERTMP)/$(pdf_arch).fo
[157ab39]132
[fd5c672]133 @echo "Rendering PDF of $(pdf_arch)..."
134 $(Q)mkdir -p $(BASEDIR)
135 $(Q)fop $(RENDERTMP)/$(pdf_arch).fo $(BASEDIR)/CLFS-$(pdf_arch).pdf
[157ab39]136
137validate: $(ARCHS_VALIDATE)
138
139$(ARCHS_VALIDATE): override validate_arch = $(@:%$(S)validate=%)
140$(ARCHS_VALIDATE):
141 @echo "Validating $(validate_arch)..."
[fd5c672]142 $(Q)xmllint --xinclude --noout --nonet --postvalid $(PWD)/$(validate_arch)-index.xml
[157ab39]143
[fd5c672]144trouble: tmpdir $(ARCHS_TROUBLE)
[157ab39]145
146$(ARCHS_TROUBLE): override trouble_arch = $(@:%$(S)trouble=%)
147$(ARCHS_TROUBLE):
148 @echo "Troubleshooting $(trouble_arch)..."
[fd5c672]149 $(Q)xmllint --xinclude --nonet --postvalid \
150 -o $(RENDERTMP)/dump-$(trouble_arch) $(PWD)/$(trouble_arch)-index.xml
151 $(Q)xmllint --xinclude --noout --nonet --valid $(RENDERTMP)/dump-$(trouble_arch)
152 @echo "You can now look at $(RENDERTMP)/dump-$(trouble_arch) to see the errors"
[157ab39]153
154dump-commands: $(ARCHS_DUMP)
155
156$(ARCHS_DUMP): override dump_arch = $(@:%$(S)dump=%)
157$(ARCHS_DUMP):
158 @echo "Extracting commands from $(dump_arch)..."
[fd5c672]159 $(Q)mkdir -p $(DUMPDIR)/$(dump_arch)
160 $(Q)xsltproc --xinclude --nonet --output $(DUMPDIR)/$(dump_arch)/ \
161 $(PWD)/stylesheets/dump-commands.xsl $(PWD)/$(dump_arch)-index.xml
[157ab39]162
163download-list: $(ARCHS_DLLIST)
164
165$(ARCHS_DLLIST): override dllist_arch = $(@:%$(S)dllist=%)
166$(ARCHS_DLLIST):
167 @echo "Creating download list for $(dllist_arch)..."
[fd5c672]168 $(Q)mkdir -p $(DLLISTDIR)
[80040d4]169 $(Q)xsltproc --xinclude --nonet --output $(DLLISTDIR)/$(dllist_arch)/dl.list \
[fd5c672]170 $(PWD)/stylesheets/wget.xsl $(PWD)/$(dllist_arch)-index.xml
[07114c98]171
172help:
[157ab39]173 @echo "HTML Targets"
174 @echo -e " \e[0;32mlfs tidy render titlepage \e[0;34m$(ARCHS_HTML)\e[0;0m"
175 @echo
176 @echo "NoChunks Targets"
177 @echo -e " \e[0;32mnochunks tidy \e[0;34m$(ARCHS_NOCHUNKS)\e[0;0m"
178 @echo
179 @echo "PDF Targets"
180 @echo -e " \e[0;32mpdf \e[0;34m$(ARCHS_PDF)\e[0;0m"
181 @echo
182 @echo "Validate Targets"
183 @echo -e " \e[0;32mvalidate \e[0;34m$(ARCHS_VALIDATE)\e[0;0m"
184 @echo
185 @echo "Trouble Targets"
186 @echo -e " \e[0;32mtrouble \e[0;34m$(ARCHS_TROUBLE)\e[0;0m"
187 @echo
188 @echo "Dump-Commands Targets"
189 @echo -e " \e[0;32mdump-commands \e[0;34m$(ARCHS_DUMP)\e[0;0m"
190 @echo
191 @echo "Download-List Targets"
192 @echo -e " \e[0;32mdownload-list \e[0;34m$(ARCHS_DLLIST)\e[0;0m"
Note: See TracBrowser for help on using the repository browser.