1 | BASEDIR=~/cross-lfs-book
|
---|
2 | DUMPDIR=~/cross-lfs-commands
|
---|
3 | DLLISTDIR=~/cross-lfs-dllist
|
---|
4 | CHUNK_QUIET=1
|
---|
5 | XSLROOTDIR=/usr/share/xml/docbook/xsl-stylesheets-current
|
---|
6 | ARCH=x86 x86_64 x86_64-64 sparc sparc64 sparc64-64 mips mips64 mips64-64 ppc alpha
|
---|
7 |
|
---|
8 | # HTML Rendering Chunked
|
---|
9 | define HTML_RENDER
|
---|
10 | echo "Rendering HTML of $$arch..." ; \
|
---|
11 | xsltproc --xinclude --nonet -stringparam profile.condition html \
|
---|
12 | -stringparam chunk.quietly $(CHUNK_QUIET) -stringparam base.dir $(BASEDIR)/$$arch/ \
|
---|
13 | $(PWD)/stylesheets/lfs-chunked.xsl $(PWD)/$$arch-index.xml ; \
|
---|
14 | mkdir -p $(BASEDIR)/$$arch/stylesheets ; \
|
---|
15 | cp $(PWD)/stylesheets/*.css $(BASEDIR)/$$arch/stylesheets ; \
|
---|
16 | cd $(BASEDIR)/$$arch/; sed -i -e "s@../stylesheets@stylesheets@g" *.html ; \
|
---|
17 | mkdir -p $(BASEDIR)/$$arch/images ; \
|
---|
18 | cp $(XSLROOTDIR)/images/*.png $(BASEDIR)/$$arch/images ; \
|
---|
19 | cd $(BASEDIR)/$$arch/; sed -i -e "s@../images@images@g" *.html
|
---|
20 | endef
|
---|
21 |
|
---|
22 | # HTML Rendering No Chunks
|
---|
23 | define HTML_RENDER2
|
---|
24 | echo "Rendering Single File HTML of $$arch..." ; \
|
---|
25 | xsltproc --xinclude --nonet -stringparam profile.condition html \
|
---|
26 | --output $(BASEDIR)/CLFS-BOOK-$$arch.html \
|
---|
27 | $(PWD)/stylesheets/lfs-nochunks.xsl $$arch-index.xml
|
---|
28 | endef
|
---|
29 |
|
---|
30 | # PDF Rendering
|
---|
31 | define PDF_RENDER
|
---|
32 | echo "Rendering PDF of $$arch..." ; \
|
---|
33 | xsltproc --xinclude --nonet --output $(BASEDIR)/lfs-pdf.fo \
|
---|
34 | $(PWD)/stylesheets/lfs-pdf.xsl $$arch-index.xml ; \
|
---|
35 | sed -i -e "s/inherit/all/" $(BASEDIR)/lfs-pdf.fo ; \
|
---|
36 | fop.sh -q $(BASEDIR)/lfs-pdf.fo -pdf $(BASEDIR)/CLFS-BOOK-$$arch.pdf ; \
|
---|
37 | rm $(BASEDIR)/lfs-pdf.fo
|
---|
38 | endef
|
---|
39 |
|
---|
40 | # Plain Text Rendering
|
---|
41 | define TEXT_RENDER
|
---|
42 | echo "Rendering Text of $$arch..." ; \
|
---|
43 | xsltproc --xinclude --nonet --output $(BASEDIR)/lfs-pdf.fo \
|
---|
44 | $(PWD)/stylesheets/lfs-pdf.xsl $$arch-index.xml ; \
|
---|
45 | sed -i -e "s/inherit/all/" $(BASEDIR)/lfs-pdf.fo ; \
|
---|
46 | fop.sh $(BASEDIR)/lfs-pdf.fo -txt $(BASEDIR)/CLFS-BOOK-$$arch.txt ; \
|
---|
47 | rm $(BASEDIR)/lfs-pdf.fo
|
---|
48 | endef
|
---|
49 |
|
---|
50 | # Validation
|
---|
51 | define VALIDATE
|
---|
52 | echo "Validating $$arch..." ; \
|
---|
53 | xmllint --xinclude --noout --nonet --postvalid $(PWD)/$$arch-index.xml
|
---|
54 | endef
|
---|
55 |
|
---|
56 | # Dump commands
|
---|
57 | define DUMP
|
---|
58 | echo "Extracting commands from $$arch..." ; \
|
---|
59 | xsltproc --xinclude --nonet --output $(DUMPDIR)/$$arch/ \
|
---|
60 | $(PWD)/stylesheets/dump-commands.xsl $$arch-index.xml
|
---|
61 | endef
|
---|
62 |
|
---|
63 | # Get commands
|
---|
64 | define DLLIST
|
---|
65 | echo "Creating download list for $$arch..." ; \
|
---|
66 | xsltproc --xinclude --nonet --output $(DLLISTDIR)/$$arch.dl.list \
|
---|
67 | $(PWD)/stylesheets/wget.xsl $$arch-index.xml
|
---|
68 | endef
|
---|
69 |
|
---|
70 | lfs: toplevel render common
|
---|
71 |
|
---|
72 | toplevel:
|
---|
73 | @xsltproc --nonet --output $(BASEDIR)/index.html $(PWD)/stylesheets/top-index.xsl $(PWD)/index.xml
|
---|
74 |
|
---|
75 | render:
|
---|
76 | @for arch in $(ARCH) ; do \
|
---|
77 | $(HTML_RENDER) ; \
|
---|
78 | done
|
---|
79 |
|
---|
80 | common:
|
---|
81 | @for filename in `find $(BASEDIR) -name "*.html"`; do \
|
---|
82 | tidy -config tidy.conf $$filename; \
|
---|
83 | true; \
|
---|
84 | sh obfuscate.sh $$filename; \
|
---|
85 | sed -i -e "s@text/html@application/xhtml+xml@g" $$filename; \
|
---|
86 | done;
|
---|
87 |
|
---|
88 | nochunks: nochunk_render common
|
---|
89 |
|
---|
90 | nochunk_render:
|
---|
91 |
|
---|
92 | @for arch in $(ARCH) ; do \
|
---|
93 | $(HTML_RENDER2) ; \
|
---|
94 | done
|
---|
95 |
|
---|
96 | pdf:
|
---|
97 | @for arch in $(ARCH) ; do \
|
---|
98 | $(PDF_RENDER) ; \
|
---|
99 | done
|
---|
100 |
|
---|
101 | text:
|
---|
102 | @for arch in $(ARCH) ; do \
|
---|
103 | $(TEXT_RENDER) ; \
|
---|
104 | done
|
---|
105 |
|
---|
106 | validate:
|
---|
107 | @for arch in $(ARCH) ; do \
|
---|
108 | $(VALIDATE) ; \
|
---|
109 | done
|
---|
110 |
|
---|
111 | dump-commands:
|
---|
112 | @for arch in $(ARCH) ; do \
|
---|
113 | $(DUMP) ; \
|
---|
114 | done
|
---|
115 |
|
---|
116 | download-list:
|
---|
117 | @for arch in $(ARCH) ; do \
|
---|
118 | $(DLLIST) ; \
|
---|
119 | done
|
---|
120 |
|
---|
121 | .PHONY: lfs toplevel common render nochunk nochunk_render pdf text validate dump-commands download-list
|
---|