source: BOOK/Makefile @ bc7834d

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

Generate the profiled XML in its own make target.

  • Property mode set to 100644
File size: 6.3 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_P_XML     := $(ARCHS:%=%-profiled-xml)
18
19ARCHS_HTML      := $(ARCHS:%=%$(S)html)
20ARCHS_NOCHUNKS  := $(ARCHS:%=%$(S)nochunks)
21ARCHS_PDF       := $(ARCHS:%=%$(S)pdf)
22ARCHS_VALIDATE  := $(ARCHS:%=%$(S)validate)
23ARCHS_TROUBLE   := $(ARCHS:%=%$(S)trouble)
24ARCHS_DUMP      := $(ARCHS:%=%$(S)dump)
25ARCHS_DLLIST    := $(ARCHS:%=%$(S)dllist)
26
27ifdef V
28  Q =
29else
30  Q = @
31endif
32
33.PHONY: lfs tidy render titlepage $(ARCHS_HTML) nochunks $(ARCHS_NOCHUNKS) pdf \
34        $(ARCHS_PDF) validate $(ARCHS_VALIDATE) trouble $(ARCHS_TROUBLE) \
35        dump-commands $(ARCHS_DUMP) download-list $(ARCHS_DLLIST) tmpdir
36
37lfs: tmpdir render tidy
38
39tmpdir:
40        @echo "Creating and cleaning $(RENDERTMP)"
41        $(Q)[ -d $(RENDERTMP) ] || mkdir -p $(RENDERTMP)
42        $(Q)rm -f $(RENDERTMP)/*-{full,html,pdf}.xml
43        $(Q)rm -f $(RENDERTMP)/*.fo
44
45ifeq ($(shell which tidy >/dev/null 2>&1 && echo yes),yes)
46tidy:
47        @echo "Running tidy on the created HTML"
48        $(Q)for filename in `find $(BASEDIR) -name "*.html"`; do \
49          tidy -config $(PWD)/tidy.conf $$filename; \
50          true; \
51          bash $(PWD)/obfuscate.sh $$filename; \
52          sed -i -e "s@text/html@application/xhtml+xml@g" $$filename; \
53        done;
54else
55tidy:
56        @echo "Tidy is not installed on this system"
57endif
58
59render: $(ARCHS_HTML) titlepage
60
61titlepage:
62        $(Q)xsltproc --nonet --output $(BASEDIR)/index.html \
63          $(PWD)/stylesheets/top-index.xsl $(PWD)/index.xml
64
65$(ARCHS_P_XML): override profiled_xml_arch = $(@:%-profiled-xml=%)
66$(ARCHS_P_XML):
67        @echo "Validating $(profiled_xml_arch) book..."
68        $(Q)xmllint --nonet --noent --xinclude --postvalid \
69          -o $(RENDERTMP)/$(profiled_xml_arch)-full.xml $(PWD)/$(profiled_xml_arch)-index.xml
70
71        @echo "Generating profiled $(profiled_xml_arch) book for XHTML..."
72        $(Q)xsltproc --nonet --stringparam profile.condition html \
73          --output $(RENDERTMP)/$(profiled_xml_arch)-html.xml \
74          $(PWD)/stylesheets/lfs-xsl/profile.xsl $(RENDERTMP)/$(profiled_xml_arch)-full.xml
75
76$(ARCHS_HTML): override html_arch = $(@:%$(S)html=%)
77$(ARCHS_HTML):
78        @$(MAKE) $(html_arch)-profiled-xml
79
80        @echo "Rendering chunked XHTML of $(html_arch)..."
81        $(Q)mkdir -p $(BASEDIR)/$(html_arch)
82        $(Q)xsltproc --nonet -stringparam chunk.quietly $(CHUNK_QUIET) \
83          -stringparam rootid "$(ROOT_ID)" \
84          -stringparam base.dir $(BASEDIR)/$(html_arch)/ \
85          $(PWD)/stylesheets/clfs-chunked.xsl $(RENDERTMP)/$(html_arch)-html.xml
86
87        @echo "Copying CSS code and images..."
88        $(Q)mkdir -p $(BASEDIR)/$(html_arch)/stylesheets
89        $(Q)cp $(PWD)/stylesheets/lfs-xsl/*.css $(BASEDIR)/$(html_arch)/stylesheets
90        $(Q)sed -i -e "s@../stylesheets@stylesheets@g" $(BASEDIR)/$(html_arch)/*.html
91        $(Q)mkdir -p $(BASEDIR)/$(html_arch)/images
92        $(Q)cp $(PWD)/images/*.png $(BASEDIR)/$(html_arch)/images
93        $(Q)sed -i -e "s@../images@images@g" $(BASEDIR)/$(html_arch)/*.html
94
95nochunks: tmpdir $(ARCHS_NOCHUNKS) tidy
96
97$(ARCHS_NOCHUNKS): override nochunk_arch = $(@:%$(S)nochunks=%)
98$(ARCHS_NOCHUNKS):
99        @$(MAKE) $(nochunk_arch)-profiled-xml
100
101        @echo "Rendering Single File HTML of $(nochunk_arch)..."
102        $(Q)mkdir -p $(BASEDIR)
103        $(Q)xsltproc --nonet -stringparam rootid "$(ROOT_ID)" \
104          --output $(BASEDIR)/CLFS-$(nochunk_arch).html \
105          $(PWD)/stylesheets/clfs-nochunks.xsl $(RENDERTMP)/$(nochunk_arch)-html.xml
106
107        @echo "Running Tidy..."
108        $(Q)tidy -config $(PWD)/tidy.conf $(BASEDIR)/CLFS-$(nochunk_arch).html || true
109        @echo "Running obfuscate.sh..."
110        $(Q)bash $(PWD)/obfuscate.sh $(BASEDIR)/CLFS-$(nochunk_arch).html
111        $(Q)sed -i -e "s@text/html@application/xhtml+xml@g"  \
112          $(BASEDIR)/CLFS-$(nochunk_arch).html
113
114pdf: tmpdir $(ARCHS_PDF)
115
116$(ARCHS_PDF): override pdf_arch =  $(@:%$(S)pdf=%)
117$(ARCHS_PDF):
118        @$(MAKE) $(pdf_arch)-profiled-xml
119
120        @echo "Generating FO file of $(pdf_arch)..."
121        $(Q)xsltproc --nonet -stringparam rootid "$(ROOT_ID)" \
122          --output $(RENDERTMP)/$(pdf_arch).fo $(PWD)/stylesheets/clfs-pdf.xsl \
123          $(RENDERTMP)/$(pdf_arch)-pdf.xml
124        $(Q)sed -i -e 's/span="inherit"/span="all"/' $(RENDERTMP)/$(pdf_arch).fo
125
126        @echo "Rendering PDF of $(pdf_arch)..."
127        $(Q)mkdir -p $(BASEDIR)
128        $(Q)fop $(RENDERTMP)/$(pdf_arch).fo $(BASEDIR)/CLFS-$(pdf_arch).pdf
129
130validate: $(ARCHS_VALIDATE)
131
132$(ARCHS_VALIDATE): override validate_arch =  $(@:%$(S)validate=%)
133$(ARCHS_VALIDATE):
134        @echo "Validating $(validate_arch)..."
135        $(Q)xmllint --xinclude --noout --nonet --postvalid $(PWD)/$(validate_arch)-index.xml
136
137trouble: tmpdir $(ARCHS_TROUBLE)
138
139$(ARCHS_TROUBLE): override trouble_arch =  $(@:%$(S)trouble=%)
140$(ARCHS_TROUBLE):
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
147dump-commands: $(ARCHS_DUMP)
148
149$(ARCHS_DUMP): override dump_arch =  $(@:%$(S)dump=%)
150$(ARCHS_DUMP):
151        @echo "Extracting commands from $(dump_arch)..."
152        $(Q)mkdir -p $(DUMPDIR)/$(dump_arch)
153        $(Q)xsltproc --xinclude --nonet --output $(DUMPDIR)/$(dump_arch)/ \
154          $(PWD)/stylesheets/dump-commands.xsl $(PWD)/$(dump_arch)-index.xml
155
156download-list: $(ARCHS_DLLIST)
157
158$(ARCHS_DLLIST): override dllist_arch = $(@:%$(S)dllist=%)
159$(ARCHS_DLLIST):
160        @echo "Creating download list for $(dllist_arch)..."
161        $(Q)mkdir -p $(DLLISTDIR)
162        $(Q)xsltproc --xinclude --nonet --output $(DLLISTDIR)/$(dllist_arch)/dl.list \
163          $(PWD)/stylesheets/wget.xsl $(PWD)/$(dllist_arch)-index.xml
164
165help:
166        @echo "Output: $(WORKDIR)"
167        @echo
168        @echo "HTML Targets"
169        @echo -e "  \e[0;32mlfs tidy render titlepage \e[0;34m$(ARCHS_HTML)\e[0;0m"
170        @echo
171        @echo "NoChunks Targets"
172        @echo -e "  \e[0;32mnochunks tidy \e[0;34m$(ARCHS_NOCHUNKS)\e[0;0m"
173        @echo
174        @echo "PDF Targets"
175        @echo -e "  \e[0;32mpdf \e[0;34m$(ARCHS_PDF)\e[0;0m"
176        @echo
177        @echo "Validate Targets"
178        @echo -e "  \e[0;32mvalidate \e[0;34m$(ARCHS_VALIDATE)\e[0;0m"
179        @echo
180        @echo "Trouble Targets"
181        @echo -e "  \e[0;32mtrouble \e[0;34m$(ARCHS_TROUBLE)\e[0;0m"
182        @echo
183        @echo "Dump-Commands Targets"
184        @echo -e "  \e[0;32mdump-commands \e[0;34m$(ARCHS_DUMP)\e[0;0m"
185        @echo
186        @echo "Download-List Targets"
187        @echo -e "  \e[0;32mdownload-list \e[0;34m$(ARCHS_DLLIST)\e[0;0m"
Note: See TracBrowser for help on using the repository browser.