source: BOOK/Makefile@ 16ca115

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since 16ca115 was 16ca115, checked in by Joe Ciccone <jciccone@…>, 15 years ago

Quiet a few more commands and clean up the terminal output.

  • Property mode set to 100644
File size: 6.5 KB
RevLine 
[2b77c9d4]1TOP := $(PWD)
2
3WORKDIR := $(TOP)/render-output
4
5BASEDIR := $(WORKDIR)/cross-lfs-book
6DUMPDIR := $(WORKDIR)/cross-lfs-commands
7DLLISTDIR := $(WORKDIR)/cross-lfs-dllist
8RENDERTMP := $(WORKDIR)/tmp
[157ab39]9CHUNK_QUIET := 1
[bc7834d]10ROOT_ID :=
[157ab39]11
12S := -
13
[d258427]14ARCHS := x86 x86_64 x86_64-64 sparc sparc64 sparc64-64 mips mips64 mips64-64 \
[97bbe67]15 ppc ppc64 alpha
[157ab39]16
[ff39de2]17ARCHS_VD_XML := $(ARCHS:%=%-validate_dump-xml)
[bc7834d]18ARCHS_P_XML := $(ARCHS:%=%-profiled-xml)
19
[157ab39]20ARCHS_HTML := $(ARCHS:%=%$(S)html)
21ARCHS_NOCHUNKS := $(ARCHS:%=%$(S)nochunks)
22ARCHS_PDF := $(ARCHS:%=%$(S)pdf)
23ARCHS_VALIDATE := $(ARCHS:%=%$(S)validate)
24ARCHS_TROUBLE := $(ARCHS:%=%$(S)trouble)
25ARCHS_DUMP := $(ARCHS:%=%$(S)dump)
26ARCHS_DLLIST := $(ARCHS:%=%$(S)dllist)
[3f8be484]27
[fd5c672]28ifdef V
29 Q =
30else
31 Q = @
32endif
33
34.PHONY: lfs tidy render titlepage $(ARCHS_HTML) nochunks $(ARCHS_NOCHUNKS) pdf \
35 $(ARCHS_PDF) validate $(ARCHS_VALIDATE) trouble $(ARCHS_TROUBLE) \
36 dump-commands $(ARCHS_DUMP) download-list $(ARCHS_DLLIST) tmpdir
[3f8be484]37
[fd5c672]38lfs: tmpdir render tidy
39
40tmpdir:
41 @echo "Creating and cleaning $(RENDERTMP)"
42 $(Q)[ -d $(RENDERTMP) ] || mkdir -p $(RENDERTMP)
43 $(Q)rm -f $(RENDERTMP)/*-{full,html,pdf}.xml
44 $(Q)rm -f $(RENDERTMP)/*.fo
[157ab39]45
46ifeq ($(shell which tidy >/dev/null 2>&1 && echo yes),yes)
47tidy:
[fd5c672]48 @echo "Running tidy on the created HTML"
49 $(Q)for filename in `find $(BASEDIR) -name "*.html"`; do \
50 tidy -config $(PWD)/tidy.conf $$filename; \
[3f8be484]51 true; \
[5644a7f]52 bash $(PWD)/obfuscate.sh $$filename; \
[3f8be484]53 sed -i -e "s@text/html@application/xhtml+xml@g" $$filename; \
54 done;
[157ab39]55else
56tidy:
[fd5c672]57 @echo "Tidy is not installed on this system"
[157ab39]58endif
59
60render: $(ARCHS_HTML) titlepage
61
62titlepage:
[fd5c672]63 $(Q)xsltproc --nonet --output $(BASEDIR)/index.html \
64 $(PWD)/stylesheets/top-index.xsl $(PWD)/index.xml
[3f8be484]65
[ff39de2]66$(ARCHS_VD_XML): override validate_dump_xml_arch = $(@:%-validate_dump-xml=%)
67$(ARCHS_VD_XML):
68 @echo "Validating $(validate_dump_xml_arch) book..."
69 $(Q)xmllint --nonet --noent --xinclude --postvalid \
70 -o $(RENDERTMP)/$(validate_dump_xml_arch)-full.xml $(PWD)/$(validate_dump_xml_arch)-index.xml
71
[bc7834d]72$(ARCHS_P_XML): override profiled_xml_arch = $(@:%-profiled-xml=%)
73$(ARCHS_P_XML):
[16ca115]74 @$(MAKE) --no-print-directory $(profiled_xml_arch)-validate_dump-xml
[fd5c672]75
[bc7834d]76 @echo "Generating profiled $(profiled_xml_arch) book for XHTML..."
[fd5c672]77 $(Q)xsltproc --nonet --stringparam profile.condition html \
[bc7834d]78 --output $(RENDERTMP)/$(profiled_xml_arch)-html.xml \
79 $(PWD)/stylesheets/lfs-xsl/profile.xsl $(RENDERTMP)/$(profiled_xml_arch)-full.xml
80
81$(ARCHS_HTML): override html_arch = $(@:%$(S)html=%)
82$(ARCHS_HTML):
[16ca115]83 @$(MAKE) --no-print-directory $(html_arch)-profiled-xml
[fd5c672]84
85 @echo "Rendering chunked XHTML of $(html_arch)..."
86 $(Q)mkdir -p $(BASEDIR)/$(html_arch)
87 $(Q)xsltproc --nonet -stringparam chunk.quietly $(CHUNK_QUIET) \
88 -stringparam rootid "$(ROOT_ID)" \
89 -stringparam base.dir $(BASEDIR)/$(html_arch)/ \
90 $(PWD)/stylesheets/clfs-chunked.xsl $(RENDERTMP)/$(html_arch)-html.xml
91
92 @echo "Copying CSS code and images..."
93 $(Q)mkdir -p $(BASEDIR)/$(html_arch)/stylesheets
94 $(Q)cp $(PWD)/stylesheets/lfs-xsl/*.css $(BASEDIR)/$(html_arch)/stylesheets
95 $(Q)sed -i -e "s@../stylesheets@stylesheets@g" $(BASEDIR)/$(html_arch)/*.html
96 $(Q)mkdir -p $(BASEDIR)/$(html_arch)/images
97 $(Q)cp $(PWD)/images/*.png $(BASEDIR)/$(html_arch)/images
98 $(Q)sed -i -e "s@../images@images@g" $(BASEDIR)/$(html_arch)/*.html
99
100nochunks: tmpdir $(ARCHS_NOCHUNKS) tidy
[157ab39]101
102$(ARCHS_NOCHUNKS): override nochunk_arch = $(@:%$(S)nochunks=%)
103$(ARCHS_NOCHUNKS):
[16ca115]104 @$(MAKE) --no-print-directory $(nochunk_arch)-profiled-xml
[fd5c672]105
[157ab39]106 @echo "Rendering Single File HTML of $(nochunk_arch)..."
[fd5c672]107 $(Q)mkdir -p $(BASEDIR)
108 $(Q)xsltproc --nonet -stringparam rootid "$(ROOT_ID)" \
109 --output $(BASEDIR)/CLFS-$(nochunk_arch).html \
110 $(PWD)/stylesheets/clfs-nochunks.xsl $(RENDERTMP)/$(nochunk_arch)-html.xml
111
112 @echo "Running Tidy..."
113 $(Q)tidy -config $(PWD)/tidy.conf $(BASEDIR)/CLFS-$(nochunk_arch).html || true
114 @echo "Running obfuscate.sh..."
[5644a7f]115 $(Q)bash $(PWD)/obfuscate.sh $(BASEDIR)/CLFS-$(nochunk_arch).html
[fd5c672]116 $(Q)sed -i -e "s@text/html@application/xhtml+xml@g" \
117 $(BASEDIR)/CLFS-$(nochunk_arch).html
[157ab39]118
[fd5c672]119pdf: tmpdir $(ARCHS_PDF)
[157ab39]120
121$(ARCHS_PDF): override pdf_arch = $(@:%$(S)pdf=%)
122$(ARCHS_PDF):
[16ca115]123 @$(MAKE) --no-print-directory $(pdf_arch)-profiled-xml
[fd5c672]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)
[80040d4]167 $(Q)xsltproc --xinclude --nonet --output $(DLLISTDIR)/$(dllist_arch)/dl.list \
[fd5c672]168 $(PWD)/stylesheets/wget.xsl $(PWD)/$(dllist_arch)-index.xml
[07114c98]169
170help:
[2b77c9d4]171 @echo "Output: $(WORKDIR)"
172 @echo
[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.