source: BOOK/Makefile@ b47a4a1

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

General cleanup of the Makefile.

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