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