[02095ae] | 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 |
|
---|
[12e7efe2] | 9 | ARCHS := arm x86 hppa
|
---|
[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:
|
---|
| 41 | @xsltproc --nonet --output $(BASEDIR)/index.html $(PWD)/stylesheets/top-index.xsl $(PWD)/index.xml
|
---|
| 42 |
|
---|
| 43 | $(ARCHS_HTML): override html_arch = $(@:%$(S)html=%)
|
---|
| 44 | $(ARCHS_HTML):
|
---|
| 45 | @echo "Rendering HTML of $(html_arch)..."
|
---|
| 46 | @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
|
---|
| 47 | @mkdir -p $(BASEDIR)/$(html_arch)/stylesheets
|
---|
| 48 | @cp $(PWD)/stylesheets/*.css $(BASEDIR)/$(html_arch)/stylesheets
|
---|
| 49 | @sed -i -e "s@../stylesheets@stylesheets@g" $(BASEDIR)/$(html_arch)/*.html
|
---|
| 50 | @mkdir -p $(BASEDIR)/$(html_arch)/images
|
---|
| 51 | @cp $(XSLROOTDIR)/images/*.png $(BASEDIR)/$(html_arch)/images
|
---|
| 52 | @sed -i -e "s@../images@images@g" $(BASEDIR)/$(html_arch)/*.html
|
---|
| 53 |
|
---|
| 54 | nochunks: $(ARCHS_NOCHUNKS) tidy
|
---|
| 55 |
|
---|
| 56 | $(ARCHS_NOCHUNKS): override nochunk_arch = $(@:%$(S)nochunks=%)
|
---|
| 57 | $(ARCHS_NOCHUNKS):
|
---|
| 58 | @echo "Rendering Single File HTML of $(nochunk_arch)..."
|
---|
| 59 | @xsltproc --xinclude --nonet -stringparam profile.condition html --output $(BASEDIR)/CLFS-BOOK-$(nochunk_arch).html $(PWD)/stylesheets/lfs-nochunks.xsl $(nochunk_arch)-index.xml
|
---|
| 60 |
|
---|
| 61 | pdf: $(ARCHS_PDF)
|
---|
| 62 |
|
---|
| 63 | $(ARCHS_PDF): override pdf_arch = $(@:%$(S)pdf=%)
|
---|
| 64 | $(ARCHS_PDF):
|
---|
| 65 | @echo "Rendering PDF of $(pdf_arch)..."
|
---|
| 66 | @xsltproc --xinclude --nonet --output $(BASEDIR)/clfs-$(pdf_arch)-pdf.fo $(PWD)/stylesheets/lfs-pdf.xsl $(pdf_arch)-index.xml
|
---|
| 67 | @sed -i -e "s/inherit/all/" $(BASEDIR)/clfs-$(pdf_arch)-pdf.fo
|
---|
| 68 | @fop.sh -q -fo $(BASEDIR)/clfs-$(pdf_arch)-pdf.fo -pdf $(BASEDIR)/CLFS-BOOK-$(pdf_arch).pdf
|
---|
| 69 | @rm $(BASEDIR)/clfs-$(pdf_arch)-pdf.fo
|
---|
| 70 |
|
---|
| 71 | text: $(ARCHS_TEXT)
|
---|
| 72 |
|
---|
| 73 | $(ARCHS_TEXT): override text_arch = $(@:%$(S)text=%)
|
---|
| 74 | $(ARCHS_TEXT):
|
---|
| 75 | @echo "Rendering Text of $(text_arch)..."
|
---|
| 76 | @xsltproc --xinclude --nonet --output $(BASEDIR)/clfs-$(text_arch)-text.fo $(PWD)/stylesheets/lfs-pdf.xsl $(text_arch)-index.xml
|
---|
| 77 | @sed -i -e "s/inherit/all/" $(BASEDIR)/clfs-$(text_arch)-text.fo ; \
|
---|
| 78 | @fop.sh -q -fo $(BASEDIR)/clfs-$(text_arch)-text.fo -txt $(BASEDIR)/CLFS-BOOK-$(text_arch).txt ; \
|
---|
| 79 | @rm $(BASEDIR)/clfs-$(text_arch)-text.fo
|
---|
| 80 |
|
---|
| 81 | validate: $(ARCHS_VALIDATE)
|
---|
| 82 |
|
---|
| 83 | $(ARCHS_VALIDATE): override validate_arch = $(@:%$(S)validate=%)
|
---|
| 84 | $(ARCHS_VALIDATE):
|
---|
| 85 | @echo "Validating $(validate_arch)..."
|
---|
| 86 | @xmllint --xinclude --noout --nonet --postvalid $(PWD)/$(validate_arch)-index.xml
|
---|
| 87 |
|
---|
| 88 | trouble: $(ARCHS_TROUBLE)
|
---|
| 89 |
|
---|
| 90 | $(ARCHS_TROUBLE): override trouble_arch = $(@:%$(S)trouble=%)
|
---|
| 91 | $(ARCHS_TROUBLE):
|
---|
| 92 | @echo "Troubleshooting $(trouble_arch)..."
|
---|
| 93 | @xmllint --xinclude --nonet --postvalid $(PWD)/$(trouble_arch)-index.xml > /tmp/dump-$(trouble_arch)
|
---|
| 94 | @xmllint --xinclude --noout --nonet --valid /tmp/dump-$(trouble_arch)
|
---|
| 95 | @echo "You can now look at /tmp/dump-$(trouble_arch) to see the errors"
|
---|
| 96 |
|
---|
| 97 | dump-commands: $(ARCHS_DUMP)
|
---|
| 98 |
|
---|
| 99 | $(ARCHS_DUMP): override dump_arch = $(@:%$(S)dump=%)
|
---|
| 100 | $(ARCHS_DUMP):
|
---|
| 101 | @echo "Extracting commands from $(dump_arch)..."
|
---|
| 102 | @xsltproc --xinclude --nonet --output $(DUMPDIR)/$(dump_arch)/ $(PWD)/stylesheets/dump-commands.xsl $(dump_arch)-index.xml
|
---|
| 103 |
|
---|
| 104 | download-list: $(ARCHS_DLLIST)
|
---|
| 105 |
|
---|
| 106 | $(ARCHS_DLLIST): override dllist_arch = $(@:%$(S)dllist=%)
|
---|
| 107 | $(ARCHS_DLLIST):
|
---|
| 108 | @echo "Creating download list for $(dllist_arch)..."
|
---|
| 109 | @xsltproc --xinclude --nonet --output $(DLLISTDIR)/$(dllist_arch).dl.list $(PWD)/stylesheets/wget.xsl $(dllist_arch)-index.xml
|
---|
| 110 |
|
---|
| 111 | help:
|
---|
| 112 | @echo "HTML Targets"
|
---|
| 113 | @echo -e " \e[0;32mlfs tidy render titlepage \e[0;34m$(ARCHS_HTML)\e[0;0m"
|
---|
| 114 | @echo
|
---|
| 115 | @echo "NoChunks Targets"
|
---|
| 116 | @echo -e " \e[0;32mnochunks tidy \e[0;34m$(ARCHS_NOCHUNKS)\e[0;0m"
|
---|
| 117 | @echo
|
---|
| 118 | @echo "PDF Targets"
|
---|
| 119 | @echo -e " \e[0;32mpdf \e[0;34m$(ARCHS_PDF)\e[0;0m"
|
---|
| 120 | @echo
|
---|
| 121 | @echo "Text Targets"
|
---|
| 122 | @echo -e " \e[0;32mtext \e[0;34m$(ARCHS_TEXT)\e[0;0m"
|
---|
| 123 | @echo
|
---|
| 124 | @echo "Validate Targets"
|
---|
| 125 | @echo -e " \e[0;32mvalidate \e[0;34m$(ARCHS_VALIDATE)\e[0;0m"
|
---|
| 126 | @echo
|
---|
| 127 | @echo "Trouble Targets"
|
---|
| 128 | @echo -e " \e[0;32mtrouble \e[0;34m$(ARCHS_TROUBLE)\e[0;0m"
|
---|
| 129 | @echo
|
---|
| 130 | @echo "Dump-Commands Targets"
|
---|
[8e23f7c] | 131 | @echo -e " \e[0;32mdump-commands \e[0;34m$(ARCHS_DUMP)\e[0;0m"
|
---|
[02095ae] | 132 | @echo
|
---|
| 133 | @echo "Download-List Targets"
|
---|
| 134 | @echo -e " \e[0;32mdownload-list \e[0;34m$(ARCHS_DLLIST)\e[0;0m"
|
---|