source: BOOK/Makefile @ 2693e8e

systemd
Last change on this file since 2693e8e was 13bc271, checked in by Chris Staub <chris@…>, 8 years ago

Remove mentions of Alpha - not used anymore

  • Property mode set to 100644
File size: 7.4 KB
Line 
1TOP             := $(shell pwd)
2RENDERDIR       := $(TOP)/../render
3
4VALIDATEDIR     := $(RENDERDIR)/validate
5PROFILEDIR      := $(RENDERDIR)/profile
6
7HTMLDIR         := $(RENDERDIR)/html
8NOCHUNKDIR      := $(RENDERDIR)/nochunk
9
10FODIR           := $(RENDERDIR)/fo
11PDFDIR          := $(RENDERDIR)/pdf
12
13TROUBLEDIR      := $(RENDERDIR)/trouble
14DUMPDIR         := $(RENDERDIR)/commands
15DLLISTDIR       := $(RENDERDIR)/download-list
16
17CHUNK_QUIET     := 1
18ROOT_ID         :=
19
20ARCHS           := x86 x86_64 x86_64-64 \
21                   sparc sparc64 sparc64-64 \
22                   mips mips64 mips64-64 \
23                   ppc ppc64 ppc64-64
24
25ifdef V
26  Q =
27else
28  Q = @
29endif
30
31.PHONY: clfs lfs
32clfs lfs: html
33
34.PHONY: tidy tidy-f tidy-d
35ifeq ($(shell which tidy >/dev/null 2>&1 && echo yes),yes)
36tidy:
37        @$(MAKE) --no-print-directory tidy-d TIDY_DIR=$(HTMLDIR)
38
39tidy-f:
40        @echo "Running tidy on F:$(shell basename $(TIDY_FILE))"
41        @$(TOP)/tidy.sh "$(TIDY_FILE)"
42
43tidy-d:
44        @echo "Running tidy on D:$(shell basename $(TIDY_DIR))"
45        @$(TOP)/tidy.sh "$(TIDY_DIR)"
46else
47tidy tidy-f tidy-d:
48        @echo "Tidy is not installed on this system"
49endif
50
51.PHONY: titlepage
52titlepage:
53        @echo "Rendering the top-level index..."
54        $(Q)xsltproc --nonet --output $(HTMLDIR)/index.html \
55          $(TOP)/stylesheets/top-index.xsl \
56          $(TOP)/index.xml
57        @$(MAKE) --no-print-directory tidy-f TIDY_FILE=$(HTMLDIR)/index.html
58
59ARCHS_VD_XML := $(ARCHS:%=%-validate_dump-xml)
60.PHONY: $(ARCHS_VD_XML)
61$(ARCHS_VD_XML): override arch = $(@:%-validate_dump-xml=%)
62$(ARCHS_VD_XML):
63        @echo "Validating $(arch) book..."
64        $(Q)mkdir -p $(VALIDATEDIR)
65        $(Q)xmllint --nonet --noent --xinclude \
66          --relaxng $(TOP)/schema/docbook/4.5/rng/docbook.rng \
67          -o $(VALIDATEDIR)/$(arch)-full.xml \
68          $(TOP)/$(arch)-index.xml
69
70ARCHS_P_XML := $(ARCHS:%=%-profiled-xml)
71.PHONY: $(ARCHS_P_XML)
72$(ARCHS_P_XML): override arch = $(@:%-profiled-xml=%)
73$(ARCHS_P_XML):
74        @$(MAKE) --no-print-directory $(arch)-validate_dump-xml
75        @echo "Generating profiled $(arch) book..."
76        $(Q)mkdir -p $(PROFILEDIR)
77        $(Q)xsltproc --nonet --stringparam profile.condition html \
78          --output $(PROFILEDIR)/$(arch)-html.xml \
79          $(TOP)/stylesheets/lfs-xsl/profile.xsl \
80          $(VALIDATEDIR)/$(arch)-full.xml
81
82ARCHS_HTML := $(ARCHS:%=%-html)
83.PHONY: html render $(ARCHS_HTML)
84html render: $(ARCHS_HTML) titlepage
85$(ARCHS_HTML): override arch = $(@:%-html=%)
86$(ARCHS_HTML):
87        @$(MAKE) --no-print-directory $(arch)-profiled-xml
88
89        @echo "Rendering chunked XHTML of $(arch)..."
90        $(Q)mkdir -p $(HTMLDIR)/$(arch)
91        $(Q)xsltproc --nonet -stringparam chunk.quietly $(CHUNK_QUIET) \
92          -stringparam rootid "$(ROOT_ID)" \
93          -stringparam base.dir $(HTMLDIR)/$(arch)/ \
94          $(TOP)/stylesheets/clfs-chunked.xsl \
95          $(PROFILEDIR)/$(arch)-html.xml
96
97        @echo "Copying CSS code and images for $(arch)..."
98        $(Q)mkdir -p $(HTMLDIR)/$(arch)/stylesheets
99        $(Q)cp $(TOP)/stylesheets/lfs-xsl/*.css $(HTMLDIR)/$(arch)/stylesheets
100        $(Q)sed -i -e "s@../stylesheets@stylesheets@g" $(HTMLDIR)/$(arch)/*.html
101        $(Q)mkdir -p $(HTMLDIR)/$(arch)/images
102        $(Q)cp $(TOP)/images/*.png $(HTMLDIR)/$(arch)/images
103        $(Q)sed -i -e "s@../images@images@g" $(HTMLDIR)/$(arch)/*.html
104
105        @$(MAKE) --no-print-directory tidy-d TIDY_DIR=$(HTMLDIR)/$(arch)
106
107ARCHS_NOCHUNKS := $(ARCHS:%=%-nochunks)
108.PHONY: nochunks $(ARCHS_NOCHUNKS)
109nochunks: $(ARCHS_NOCHUNKS)
110$(ARCHS_NOCHUNKS): override arch = $(@:%-nochunks=%)
111$(ARCHS_NOCHUNKS):
112        @$(MAKE) --no-print-directory $(arch)-profiled-xml
113
114        @echo "Rendering Single File HTML of $(arch)..."
115        $(Q)mkdir -p $(NOCHUNKDIR)
116        $(Q)xsltproc --nonet -stringparam rootid "$(ROOT_ID)" \
117          --output $(NOCHUNKDIR)/CLFS-$(arch).html \
118          $(TOP)/stylesheets/clfs-nochunks.xsl \
119          $(PROFILEDIR)/$(arch)-html.xml
120
121        @$(MAKE) --no-print-directory tidy-f TIDY_FILE=$(NOCHUNKDIR)/CLFS-$(arch).html
122
123ARCHS_FO := $(ARCHS:%=%-fo)
124.PHONY: fo $(ARCHS_FO)
125fo: $(ARCHS_FO)
126$(ARCHS_FO): override arch = $(@:%-fo=%)
127$(ARCHS_FO):
128        @$(MAKE) --no-print-directory $(arch)-profiled-xml
129
130        @echo "Generating FO file of $(arch)..."
131        @mkdir -p $(FODIR)
132        $(Q)xsltproc --nonet -stringparam rootid "$(ROOT_ID)" \
133          --output $(FODIR)/$(arch).fo \
134          $(TOP)/stylesheets/clfs-pdf.xsl \
135          $(PROFILEDIR)/$(arch)-html.xml
136        $(Q)sed -i -e 's/span="inherit"/span="all"/' $(FODIR)/$(arch).fo
137
138ARCHS_PDF := $(ARCHS:%=%-pdf)
139.PHONY: pdf $(ARCHS_PDF)
140pdf: $(ARCHS_PDF)
141$(ARCHS_PDF): override arch = $(@:%-pdf=%)
142$(ARCHS_PDF):
143        @$(MAKE) --no-print-directory $(arch)-fo
144
145        @echo "Rendering PDF of $(arch)..."
146        $(Q)mkdir -p $(PDFDIR)
147        $(Q)fop $(FODIR)/$(arch).fo $(PDFDIR)/CLFS-$(arch).pdf
148
149ARCHS_VALIDATE := $(ARCHS:%=%-validate)
150.PHONY: validate $(ARCHS_VALIDATE)
151validate: $(ARCHS_VALIDATE)
152$(ARCHS_VALIDATE): override arch =  $(@:%-validate=%)
153$(ARCHS_VALIDATE):
154        @echo "Validating $(arch)..."
155        $(Q)xmllint --xinclude --noout --nonet \
156          --relaxng $(TOP)/schema/docbook/4.5/rng/docbook.rng \
157          $(TOP)/$(arch)-index.xml
158
159ARCHS_TROUBLE := $(ARCHS:%=%-trouble)
160.PHONY: trouble $(ARCHS_TROUBLE)
161trouble: $(ARCHS_TROUBLE)
162$(ARCHS_TROUBLE): override arch = $(@:%-trouble=%)
163$(ARCHS_TROUBLE):
164        @echo "Troubleshooting $(arch)..."
165        @mkdir -p $(TROUBLEDIR)
166        $(Q)xmllint --xinclude --nonet \
167          --relaxng $(TOP)/schema/docbook/4.5/rng/docbook.rng \
168          -o $(TROUBLEDIR)/dump-$(arch) \
169          $(TOP)/$(arch)-index.xml
170        $(Q)xmllint --xinclude --noout --nonet \
171          --relaxng $(TOP)/schema/docbook/4.5/rng/docbook.rng \
172          $(TROUBLEDIR)/dump-$(arch)
173        @echo "You can now look at $(TROUBLEDIR)/dump-$(arch) to see the errors"
174
175ARCHS_DUMP := $(ARCHS:%=%-dump)
176.PHONY: dump-commands $(ARCHS_DUMP)
177dump-commands: $(ARCHS_DUMP)
178$(ARCHS_DUMP): override arch = $(@:%-dump=%)
179$(ARCHS_DUMP):
180        @echo "Extracting commands from $(arch)..."
181        $(Q)mkdir -p $(DUMPDIR)/$(arch)
182        $(Q)xsltproc --xinclude --nonet \
183          --output $(DUMPDIR)/$(arch)/ \
184          $(TOP)/stylesheets/dump-commands.xsl \
185          $(TOP)/$(arch)-index.xml
186
187ARCHS_DLLIST := $(ARCHS:%=%-dllist)
188.PHONY: download-list $(ARCHS_DLLIST)
189download-list: $(ARCHS_DLLIST)
190$(ARCHS_DLLIST): override arch = $(@:%-dllist=%)
191$(ARCHS_DLLIST):
192        @echo "Creating download list for $(arch)..."
193        $(Q)mkdir -p $(DLLISTDIR)
194        $(Q)xsltproc --xinclude --nonet \
195          --output $(DLLISTDIR)/$(arch).list \
196          $(TOP)/stylesheets/wget.xsl \
197          $(TOP)/$(arch)-index.xml
198
199ARCHS_MD5LIST := $(ARCHS:%=%-md5list)
200.PHONY: md5-list $(ARCHS_MD5LIST)
201md5-list: $(ARCHS_MD5LIST)
202$(ARCHS_MD5LIST): override arch = $(@:%-md5list=%)
203$(ARCHS_MD5LIST):
204        @echo "Creating md5 hash list for $(arch)..."
205        $(Q)mkdir -p $(DLLISTDIR)
206        $(Q)xsltproc --xinclude --nonet \
207          --output $(DLLISTDIR)/$(arch).md5sum \
208          $(TOP)/stylesheets/md5sum.xsl \
209          $(TOP)/$(arch)-index.xml
210       
211FG_GREEN := $(shell echo -e '\e[0;32m')
212FG_BLUE := $(shell echo -e '\e[0;34m')
213FG_DEFAULT := $(shell echo -e '\e[0;0m')
214help:
215        @echo "Output: $(RENDERDIR)"
216        @echo
217        @echo "HTML Targets"
218        @echo $(FG_GREEN)clfs lfs tidy html render titlepage $(FG_BLUE)$(ARCHS_HTML)$(FG_DEFAULT)"
219        @echo
220        @echo "NoChunks Targets"
221        @echo $(FG_GREEN)nochunks tidy $(FG_BLUE)$(ARCHS_NOCHUNKS)$(FG_DEFAULT)"
222        @echo
223        @echo "FO Targets"
224        @echo $(FG_GREEN)fo $(FG_BLUE)$(ARCHS_FO)$(FG_DEFAULT)"
225        @echo
226        @echo "PDF Targets"
227        @echo $(FG_GREEN)pdf $(FG_BLUE)$(ARCHS_PDF)$(FG_DEFAULT)"
228        @echo
229        @echo "Validate Targets"
230        @echo $(FG_GREEN)validate $(FG_BLUE)$(ARCHS_VALIDATE)$(FG_DEFAULT)"
231        @echo
232        @echo "Trouble Targets"
233        @echo $(FG_GREEN)trouble $(FG_BLUE)$(ARCHS_TROUBLE)$(FG_DEFAULT)"
234        @echo
235        @echo "Dump-Commands Targets"
236        @echo $(FG_GREEN)dump-commands $(FG_BLUE)$(ARCHS_DUMP)$(FG_DEFAULT)"
237        @echo
238        @echo "Download-List Targets"
239        @echo $(FG_GREEN)download-list $(FG_BLUE)$(ARCHS_DLLIST)$(FG_DEFAULT)"
240        @echo
241        @echo "md5-List Targets"
242        @echo $(FG_GREEN)md5-list $(FG_BLUE)$(ARCHS_MD5LIST)$(FG_DEFAULT)"
Note: See TracBrowser for help on using the repository browser.