source: clfs-embedded/BOOK/Makefile@ 122ebf0

Last change on this file since 122ebf0 was 122ebf0, checked in by Manuel Canales Esparcia <manuel@…>, 17 years ago

Updated Makefile to use the new stylesheets.

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