source: clfs-embedded/BOOK/Makefile@ 5f18bea

Last change on this file since 5f18bea was b1d44e4, checked in by Andrew Bradford <andrew@…>, 11 years ago

Makefile: Remove wrt

So that wrt book won't be built.

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