source: BOOK/Makefile@ 5215448

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

Rearrange the makefile. Create a tidy.sh script to replace the tidy target and create a tidy target that calls this script. Also make sure that the rendertmp dir is available for whatever target needs it.

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