Subversion Repositories svn LFS-FR

Rev

Rev 1176 | Details | Compare with Previous | Last modification | View Log | RSS feed

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