source: BOOK/Makefile@ c01b0f33

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since c01b0f33 was fd5c672, checked in by Manuel Canales Esparcia <manuel@…>, 17 years ago

Updated Makefile to use the new XSL code.

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