source: clfs-sysroot/BOOK/Makefile@ 42910b8

Last change on this file since 42910b8 was 58ccb9a, checked in by Manuel Canales Esparcia <manuel@…>, 17 years ago

Makefile typo fix.

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