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