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-1.69.1
|
---|
6 | ARCH=x86 x86_64 x86_64-64 sparc sparc64 sparc64-64 mips mips64 mips64-64 ppc ppc64 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 | # TroubleShoot
|
---|
57 | define TROUBLE
|
---|
58 | echo "Troubleshooting $$arch..." ; \
|
---|
59 | xmllint --xinclude --nonet --postvalid $(PWD)/$$arch-index.xml > /tmp/dump-$$arch ; \
|
---|
60 | xmllint --xinclude --noout --nonet --valid /tmp/dump-$$arch ; \
|
---|
61 | echo "You can now look at /tmp/dump-$$arch to see the errors"
|
---|
62 | endef
|
---|
63 |
|
---|
64 | # Dump commands
|
---|
65 | define DUMP
|
---|
66 | echo "Extracting commands from $$arch..." ; \
|
---|
67 | xsltproc --xinclude --nonet --output $(DUMPDIR)/$$arch/ \
|
---|
68 | $(PWD)/stylesheets/dump-commands.xsl $$arch-index.xml
|
---|
69 | endef
|
---|
70 |
|
---|
71 | # Get commands
|
---|
72 | define DLLIST
|
---|
73 | echo "Creating download list for $$arch..." ; \
|
---|
74 | xsltproc --xinclude --nonet --output $(DLLISTDIR)/$$arch.dl.list \
|
---|
75 | $(PWD)/stylesheets/wget.xsl $$arch-index.xml
|
---|
76 | endef
|
---|
77 |
|
---|
78 | clfs: toplevel render common
|
---|
79 |
|
---|
80 | toplevel:
|
---|
81 | @xsltproc --nonet --output $(BASEDIR)/index.html $(PWD)/stylesheets/top-index.xsl $(PWD)/index.xml
|
---|
82 |
|
---|
83 | render:
|
---|
84 | @for arch in $(ARCH) ; do \
|
---|
85 | $(HTML_RENDER) ; \
|
---|
86 | done
|
---|
87 |
|
---|
88 | common:
|
---|
89 | @for filename in `find $(BASEDIR) -name "*.html"`; do \
|
---|
90 | tidy -config tidy.conf $$filename; \
|
---|
91 | true; \
|
---|
92 | sh obfuscate.sh $$filename; \
|
---|
93 | sed -i -e "s@text/html@application/xhtml+xml@g" $$filename; \
|
---|
94 | done;
|
---|
95 |
|
---|
96 | nochunks: nochunk_render common
|
---|
97 |
|
---|
98 | nochunk_render:
|
---|
99 |
|
---|
100 | @for arch in $(ARCH) ; do \
|
---|
101 | $(HTML_RENDER2) ; \
|
---|
102 | done
|
---|
103 |
|
---|
104 | pdf:
|
---|
105 | @for arch in $(ARCH) ; do \
|
---|
106 | $(PDF_RENDER) ; \
|
---|
107 | done
|
---|
108 |
|
---|
109 | text:
|
---|
110 | @for arch in $(ARCH) ; do \
|
---|
111 | $(TEXT_RENDER) ; \
|
---|
112 | done
|
---|
113 |
|
---|
114 | validate:
|
---|
115 | @for arch in $(ARCH) ; do \
|
---|
116 | $(VALIDATE) ; \
|
---|
117 | done
|
---|
118 |
|
---|
119 | trouble:
|
---|
120 | @for arch in $(ARCH) ; do \
|
---|
121 | $(TROUBLE) ; \
|
---|
122 | done
|
---|
123 |
|
---|
124 | dump-commands:
|
---|
125 | @for arch in $(ARCH) ; do \
|
---|
126 | $(DUMP) ; \
|
---|
127 | done
|
---|
128 |
|
---|
129 | download-list:
|
---|
130 | @for arch in $(ARCH) ; do \
|
---|
131 | $(DLLIST) ; \
|
---|
132 | done
|
---|
133 |
|
---|
134 | target-list:
|
---|
135 | @printf "%-15s %-10s\n" "Architecture" "Build Type" ;\
|
---|
136 | for arch in $(ARCH) ; do \
|
---|
137 | MULTILIB=0 ;\
|
---|
138 | PURE64=0 ;\
|
---|
139 | TEST="`echo $$arch | grep -c -e '-64'`" ;\
|
---|
140 | if [ "$$TEST" = "1" ]; then \
|
---|
141 | PURE64=1 ;\
|
---|
142 | else \
|
---|
143 | TEST="`echo $$arch | grep -c -e '64'`" ;\
|
---|
144 | if [ "$$TEST" = "1" ]; then \
|
---|
145 | MULTILIB=1 ;\
|
---|
146 | fi; \
|
---|
147 | fi; \
|
---|
148 | if [ "$$PURE64" = "1" ]; then \
|
---|
149 | printf "%-15s %-10s\n" $$arch "Pure 64" ;\
|
---|
150 | else \
|
---|
151 | if [ "$$MULTILIB" = "1" ]; then \
|
---|
152 | printf "%-15s %-10s\n" $$arch "Multilib" ;\
|
---|
153 | else \
|
---|
154 | printf "%-15s %-10s\n" $$arch "Default" ;\
|
---|
155 | fi; \
|
---|
156 | fi; \
|
---|
157 | done
|
---|
158 |
|
---|
159 | help:
|
---|
160 | @printf "%-25s %-20s\n" "Command" "Function"
|
---|
161 | @printf "%-25s %-20s\n" "make download-list" "Create download file lists"
|
---|
162 | @printf "%-25s %-20s\n" "make dump-commands" "Dump all the commands from the book"
|
---|
163 | @printf "%-25s %-20s\n" "make clfs" "Make the standard multilib page book"
|
---|
164 | @printf "%-25s %-20s\n" "make nochunks" "Make single html file book"
|
---|
165 | @printf "%-25s %-20s\n" "make pdf" "Make pdf copy of the book"
|
---|
166 | @printf "%-25s %-20s\n" "make target-list" "Get List of Architecture targets"
|
---|
167 | @printf "%-25s %-20s\n" "make test" "Make a text copy of the book"
|
---|
168 | @printf "%-25s %-20s\n" "make trouble" "Make a copy tha's easy to troubleshoot"
|
---|
169 | @printf "%-25s %-20s\n" "make validate" "Run book validation"
|
---|
170 |
|
---|
171 | .PHONY: clfs toplevel common render nochunks nochunk_render pdf text validate trouble dump-commands download-list \
|
---|
172 | target-list help
|
---|