source: BOOK/Makefile @ 2b77c9d4

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

Do all the work in a temporary directory in the book tree. Also add a .gitignore to prevent git from trying to commit these files.

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