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 |
|
---|
7 | S := -
|
---|
8 |
|
---|
9 | ARCHS := arm
|
---|
10 |
|
---|
11 | ARCHS_HTML := $(ARCHS:%=%$(S)html)
|
---|
12 | ARCHS_NOCHUNKS := $(ARCHS:%=%$(S)nochunks)
|
---|
13 | ARCHS_PDF := $(ARCHS:%=%$(S)pdf)
|
---|
14 | ARCHS_TEXT := $(ARCHS:%=%$(S)text)
|
---|
15 | ARCHS_VALIDATE := $(ARCHS:%=%$(S)validate)
|
---|
16 | ARCHS_TROUBLE := $(ARCHS:%=%$(S)trouble)
|
---|
17 | ARCHS_DUMP := $(ARCHS:%=%$(S)dump)
|
---|
18 | ARCHS_DLLIST := $(ARCHS:%=%$(S)dllist)
|
---|
19 |
|
---|
20 | lfs: render tidy
|
---|
21 |
|
---|
22 | tidy:
|
---|
23 | @echo Running tidy on the created HTML
|
---|
24 | @for filename in `find $(BASEDIR) -name "*.html"`; do \
|
---|
25 | tidy -config tidy.conf $$filename; \
|
---|
26 | true; \
|
---|
27 | sh obfuscate.sh $$filename; \
|
---|
28 | sed -i -e "s@text/html@application/xhtml+xml@g" $$filename; \
|
---|
29 | done;
|
---|
30 |
|
---|
31 | render: $(ARCHS_HTML) titlepage
|
---|
32 |
|
---|
33 | titlepage:
|
---|
34 | @xsltproc --nonet --output $(BASEDIR)/index.html $(PWD)/stylesheets/top-index.xsl $(PWD)/index.xml
|
---|
35 |
|
---|
36 | $(ARCHS_HTML): override html_arch = $(@:%$(S)html=%)
|
---|
37 | $(ARCHS_HTML):
|
---|
38 | @echo "Rendering HTML of $(html_arch)..."
|
---|
39 | @xsltproc --xinclude --nonet -stringparam profile.condition html -stringparam chunk.quietly $(CHUNK_QUIET) -stringparam base.dir $(BASEDIR)/$(html_arch)/ $(PWD)/stylesheets/lfs-chunked.xsl $(PWD)/$(html_arch)-index.xml
|
---|
40 | @mkdir -p $(BASEDIR)/$(html_arch)/stylesheets
|
---|
41 | @cp $(PWD)/stylesheets/*.css $(BASEDIR)/$(html_arch)/stylesheets
|
---|
42 | @sed -i -e "s@../stylesheets@stylesheets@g" $(BASEDIR)/$(html_arch)/*.html
|
---|
43 | @mkdir -p $(BASEDIR)/$(html_arch)/images
|
---|
44 | @cp $(XSLROOTDIR)/images/*.png $(BASEDIR)/$(html_arch)/images
|
---|
45 | @sed -i -e "s@../images@images@g" $(BASEDIR)/$(html_arch)/*.html
|
---|
46 |
|
---|
47 | nochunks: $(ARCHS_NOCHUNKS) tidy
|
---|
48 |
|
---|
49 | $(ARCHS_NOCHUNKS): override nochunk_arch = $(@:%$(S)nochunks=%)
|
---|
50 | $(ARCHS_NOCHUNKS):
|
---|
51 | @echo "Rendering Single File HTML of $(nochunk_arch)..."
|
---|
52 | @xsltproc --xinclude --nonet -stringparam profile.condition html --output $(BASEDIR)/CLFS-BOOK-$(nochunk_arch).html $(PWD)/stylesheets/lfs-nochunks.xsl $(nochunk_arch)-index.xml
|
---|
53 |
|
---|
54 | pdf: $(ARCHS_PDF)
|
---|
55 |
|
---|
56 | $(ARCHS_PDF): override pdf_arch = $(@:%$(S)pdf=%)
|
---|
57 | $(ARCHS_PDF):
|
---|
58 | @echo "Rendering PDF of $(pdf_arch)..."
|
---|
59 | @xsltproc --xinclude --nonet --output $(BASEDIR)/clfs-$(pdf_arch)-pdf.fo $(PWD)/stylesheets/lfs-pdf.xsl $(pdf_arch)-index.xml
|
---|
60 | @sed -i -e "s/inherit/all/" $(BASEDIR)/clfs-$(pdf_arch)-pdf.fo
|
---|
61 | @fop.sh -q -fo $(BASEDIR)/clfs-$(pdf_arch)-pdf.fo -pdf $(BASEDIR)/CLFS-BOOK-$(pdf_arch).pdf
|
---|
62 | @rm $(BASEDIR)/clfs-$(pdf_arch)-pdf.fo
|
---|
63 |
|
---|
64 | text: $(ARCHS_TEXT)
|
---|
65 |
|
---|
66 | $(ARCHS_TEXT): override text_arch = $(@:%$(S)text=%)
|
---|
67 | $(ARCHS_TEXT):
|
---|
68 | @echo "Rendering Text of $(text_arch)..."
|
---|
69 | @xsltproc --xinclude --nonet --output $(BASEDIR)/clfs-$(text_arch)-text.fo $(PWD)/stylesheets/lfs-pdf.xsl $(text_arch)-index.xml
|
---|
70 | @sed -i -e "s/inherit/all/" $(BASEDIR)/clfs-$(text_arch)-text.fo ; \
|
---|
71 | @fop.sh -q -fo $(BASEDIR)/clfs-$(text_arch)-text.fo -txt $(BASEDIR)/CLFS-BOOK-$(text_arch).txt ; \
|
---|
72 | @rm $(BASEDIR)/clfs-$(text_arch)-text.fo
|
---|
73 |
|
---|
74 | validate: $(ARCHS_VALIDATE)
|
---|
75 |
|
---|
76 | $(ARCHS_VALIDATE): override validate_arch = $(@:%$(S)validate=%)
|
---|
77 | $(ARCHS_VALIDATE):
|
---|
78 | @echo "Validating $(validate_arch)..."
|
---|
79 | @xmllint --xinclude --noout --nonet --postvalid $(PWD)/$(validate_arch)-index.xml
|
---|
80 |
|
---|
81 | trouble: $(ARCHS_TROUBLE)
|
---|
82 |
|
---|
83 | $(ARCHS_TROUBLE): override trouble_arch = $(@:%$(S)trouble=%)
|
---|
84 | $(ARCHS_TROUBLE):
|
---|
85 | @echo "Troubleshooting $(trouble_arch)..."
|
---|
86 | @xmllint --xinclude --nonet --postvalid $(PWD)/$(trouble_arch)-index.xml > /tmp/dump-$(trouble_arch)
|
---|
87 | @xmllint --xinclude --noout --nonet --valid /tmp/dump-$(trouble_arch)
|
---|
88 | @echo "You can now look at /tmp/dump-$(trouble_arch) to see the errors"
|
---|
89 |
|
---|
90 | dump-commands: $(ARCHS_DUMP)
|
---|
91 |
|
---|
92 | $(ARCHS_DUMP): override dump_arch = $(@:%$(S)dump=%)
|
---|
93 | $(ARCHS_DUMP):
|
---|
94 | @echo "Extracting commands from $(dump_arch)..."
|
---|
95 | @xsltproc --xinclude --nonet --output $(DUMPDIR)/$(dump_arch)/ $(PWD)/stylesheets/dump-commands.xsl $(dump_arch)-index.xml
|
---|
96 |
|
---|
97 | download-list: $(ARCHS_DLLIST)
|
---|
98 |
|
---|
99 | $(ARCHS_DLLIST): override dllist_arch = $(@:%$(S)dllist=%)
|
---|
100 | $(ARCHS_DLLIST):
|
---|
101 | @echo "Creating download list for $(dllist_arch)..."
|
---|
102 | @xsltproc --xinclude --nonet --output $(DLLISTDIR)/$(dllist_arch).dl.list $(PWD)/stylesheets/wget.xsl $(dllist_arch)-index.xml
|
---|
103 |
|
---|
104 | help:
|
---|
105 | @echo "HTML Targets"
|
---|
106 | @echo -e " \e[0;32mlfs tidy render titlepage \e[0;34m$(ARCHS_HTML)\e[0;0m"
|
---|
107 | @echo
|
---|
108 | @echo "NoChunks Targets"
|
---|
109 | @echo -e " \e[0;32mnochunks tidy \e[0;34m$(ARCHS_NOCHUNKS)\e[0;0m"
|
---|
110 | @echo
|
---|
111 | @echo "PDF Targets"
|
---|
112 | @echo -e " \e[0;32mpdf \e[0;34m$(ARCHS_PDF)\e[0;0m"
|
---|
113 | @echo
|
---|
114 | @echo "Text Targets"
|
---|
115 | @echo -e " \e[0;32mtext \e[0;34m$(ARCHS_TEXT)\e[0;0m"
|
---|
116 | @echo
|
---|
117 | @echo "Validate Targets"
|
---|
118 | @echo -e " \e[0;32mvalidate \e[0;34m$(ARCHS_VALIDATE)\e[0;0m"
|
---|
119 | @echo
|
---|
120 | @echo "Trouble Targets"
|
---|
121 | @echo -e " \e[0;32mtrouble \e[0;34m$(ARCHS_TROUBLE)\e[0;0m"
|
---|
122 | @echo
|
---|
123 | @echo "Dump-Commands Targets"
|
---|
124 | @echo -e " \e[0;32mdump-commands \e[0;34m$(ARCHS_DUMP)\e[0;0m"
|
---|
125 | @echo
|
---|
126 | @echo "Download-List Targets"
|
---|
127 | @echo -e " \e[0;32mdownload-list \e[0;34m$(ARCHS_DLLIST)\e[0;0m"
|
---|