[b8a78d6] | 1 | BASEDIR := ~/cross-lfs-sysroot-book
|
---|
| 2 | DUMPDIR := ~/cross-lfs-sysroot-commands
|
---|
| 3 | DLLISTDIR := ~/cross-lfs-sysroot-dllist
|
---|
[b7f86eb] | 4 | RENDERTMP := $(HOME)/tmp
|
---|
[02095ae] | 5 | CHUNK_QUIET := 1
|
---|
[b7f86eb] | 6 | ROOT_ID :=
|
---|
[02095ae] | 7 |
|
---|
| 8 | S := -
|
---|
| 9 |
|
---|
[c78de1a] | 10 | ARCHS := alpha arm hppa x86
|
---|
[02095ae] | 11 |
|
---|
| 12 | ARCHS_HTML := $(ARCHS:%=%$(S)html)
|
---|
| 13 | ARCHS_NOCHUNKS := $(ARCHS:%=%$(S)nochunks)
|
---|
| 14 | ARCHS_PDF := $(ARCHS:%=%$(S)pdf)
|
---|
| 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 |
|
---|
[b7f86eb] | 20 | ifdef V
|
---|
| 21 | Q =
|
---|
| 22 | else
|
---|
| 23 | Q = @
|
---|
| 24 | endif
|
---|
| 25 |
|
---|
| 26 | .PHONY: lfs tidy render titlepage $(ARCHS_HTML) nochunks $(ARCHS_NOCHUNKS) pdf \
|
---|
| 27 | $(ARCHS_PDF) validate $(ARCHS_VALIDATE) trouble $(ARCHS_TROUBLE) \
|
---|
| 28 | dump-commands $(ARCHS_DUMP) download-list $(ARCHS_DLLIST) tmpdir
|
---|
[4421c53] | 29 |
|
---|
[b7f86eb] | 30 | lfs: tmpdir render tidy
|
---|
| 31 |
|
---|
| 32 | tmpdir:
|
---|
| 33 | @echo "Creating and cleaning $(RENDERTMP)"
|
---|
| 34 | $(Q)[ -d $(RENDERTMP) ] || mkdir -p $(RENDERTMP)
|
---|
| 35 | $(Q)rm -f $(RENDERTMP)/*-{full,html,pdf}.xml
|
---|
| 36 | $(Q)rm -f $(RENDERTMP)/*.fo
|
---|
[02095ae] | 37 |
|
---|
[4421c53] | 38 | ifeq ($(shell which tidy >/dev/null 2>&1 && echo yes),yes)
|
---|
[02095ae] | 39 | tidy:
|
---|
[b7f86eb] | 40 | @echo "Running tidy on the created HTML"
|
---|
| 41 | $(Q)for filename in `find $(BASEDIR) -name "*.html"`; do \
|
---|
| 42 | tidy -config $(PWD)/tidy.conf $$filename; \
|
---|
[02095ae] | 43 | true; \
|
---|
[b7f86eb] | 44 | sh $(PWD)/obfuscate.sh $$filename; \
|
---|
[02095ae] | 45 | sed -i -e "s@text/html@application/xhtml+xml@g" $$filename; \
|
---|
| 46 | done;
|
---|
[4421c53] | 47 | else
|
---|
| 48 | tidy:
|
---|
[b7f86eb] | 49 | @echo "Tidy is not installed on this system"
|
---|
[4421c53] | 50 | endif
|
---|
[02095ae] | 51 |
|
---|
| 52 | render: $(ARCHS_HTML) titlepage
|
---|
| 53 |
|
---|
| 54 | titlepage:
|
---|
[c78de1a] | 55 | @echo "Rendering Top Index"
|
---|
[b7f86eb] | 56 | $(Q)xsltproc --nonet --output $(BASEDIR)/index.html \
|
---|
| 57 | $(PWD)/stylesheets/top-index.xsl $(PWD)/index.xml
|
---|
[02095ae] | 58 |
|
---|
| 59 | $(ARCHS_HTML): override html_arch = $(@:%$(S)html=%)
|
---|
| 60 | $(ARCHS_HTML):
|
---|
[b7f86eb] | 61 | @echo "Validating $(html_arch) book..."
|
---|
| 62 | $(Q)xmllint --nonet --noent --xinclude --postvalid \
|
---|
| 63 | -o $(RENDERTMP)/$(html_arch)-full.xml $(PWD)/$(html_arch)-index.xml
|
---|
| 64 |
|
---|
| 65 | @echo "Generating profiled $(html_arch) book for XHTML..."
|
---|
| 66 | $(Q)xsltproc --nonet --stringparam profile.condition html \
|
---|
| 67 | --output $(RENDERTMP)/$(html_arch)-html.xml \
|
---|
| 68 | $(PWD)/stylesheets/lfs-xsl/profile.xsl $(RENDERTMP)/$(html_arch)-full.xml
|
---|
| 69 |
|
---|
| 70 | @echo "Rendering chunked XHTML of $(html_arch)..."
|
---|
| 71 | $(Q)xsltproc --nonet -stringparam chunk.quietly $(CHUNK_QUIET) \
|
---|
| 72 | -stringparam rootid "$(ROOT_ID)" \
|
---|
| 73 | -stringparam base.dir $(BASEDIR)/$(html_arch)/ \
|
---|
| 74 | $(PWD)/stylesheets/clfs-chunked.xsl $(RENDERTMP)/$(html_arch)-html.xml
|
---|
| 75 |
|
---|
| 76 | @echo "Copying CSS code and images..."
|
---|
| 77 | $(Q)mkdir -p $(BASEDIR)/$(html_arch)/stylesheets
|
---|
| 78 | $(Q)cp $(PWD)/stylesheets/lfs-xsl/*.css $(BASEDIR)/$(html_arch)/stylesheets
|
---|
| 79 | $(Q)sed -i -e "s@../stylesheets@stylesheets@g" $(BASEDIR)/$(html_arch)/*.html
|
---|
| 80 | $(Q)mkdir -p $(BASEDIR)/$(html_arch)/images
|
---|
| 81 | $(Q)cp $(PWD)/images/*.png $(BASEDIR)/$(html_arch)/images
|
---|
| 82 | $(Q)sed -i -e "s@../images@images@g" $(BASEDIR)/$(html_arch)/*.html
|
---|
| 83 |
|
---|
| 84 | nochunks: tmpdir $(ARCHS_NOCHUNKS) tidy
|
---|
[02095ae] | 85 |
|
---|
| 86 | $(ARCHS_NOCHUNKS): override nochunk_arch = $(@:%$(S)nochunks=%)
|
---|
| 87 | $(ARCHS_NOCHUNKS):
|
---|
[b7f86eb] | 88 | @echo "Validating $(nochunk_arch) book..."
|
---|
| 89 | $(Q)xmllint --nonet --noent --xinclude --postvalid \
|
---|
| 90 | -o $(RENDERTMP)/$(nochunk_arch)-full.xml $(PWD)/$(nochunk_arch)-index.xml
|
---|
| 91 |
|
---|
| 92 | @echo "Generating profiled $(nochunk_arch) book for XHTML..."
|
---|
| 93 | $(Q)xsltproc --nonet --stringparam profile.condition html \
|
---|
| 94 | --output $(RENDERTMP)/$(nochunk_arch)-html.xml \
|
---|
| 95 | $(PWD)/stylesheets/lfs-xsl/profile.xsl \
|
---|
| 96 | $(RENDERTMP)/$(nochunk_arch)-full.xml
|
---|
| 97 |
|
---|
[02095ae] | 98 | @echo "Rendering Single File HTML of $(nochunk_arch)..."
|
---|
[b7f86eb] | 99 | $(Q)xsltproc --nonet -stringparam rootid "$(ROOT_ID)" \
|
---|
| 100 | --output $(BASEDIR)/CLFS-EMBEDDED-$(nochunk_arch).html \
|
---|
| 101 | $(PWD)/stylesheets/clfs-nochunks.xsl $(RENDERTMP)/$(nochunk_arch)-html.xml
|
---|
| 102 |
|
---|
| 103 | @echo "Running Tidy..."
|
---|
| 104 | $(Q)tidy -config $(PWD)/tidy.conf $(BASEDIR)/CLFS-EMBEDDED-$(nochunk_arch).html || true
|
---|
| 105 | @echo "Running obfuscate.sh..."
|
---|
| 106 | $(Q)sh $(PWD)/obfuscate.sh $(BASEDIR)/CLFS-EMBEDDED-$(nochunk_arch).html
|
---|
| 107 | $(Q)sed -i -e "s@text/html@application/xhtml+xml@g" \
|
---|
| 108 | $(BASEDIR)/CLFS-EMBEDDED-$(nochunk_arch).html
|
---|
[02095ae] | 109 |
|
---|
[b7f86eb] | 110 | pdf: tmpdir $(ARCHS_PDF)
|
---|
[02095ae] | 111 |
|
---|
| 112 | $(ARCHS_PDF): override pdf_arch = $(@:%$(S)pdf=%)
|
---|
| 113 | $(ARCHS_PDF):
|
---|
[b7f86eb] | 114 | @echo "Validating $(pdf_arch) book..."
|
---|
| 115 | $(Q)xmllint --nonet --noent --xinclude --postvalid \
|
---|
| 116 | -o $(RENDERTMP)/$(pdf_arch)-full.xml $(PWD)/$(pdf_arch)-index.xml
|
---|
| 117 |
|
---|
| 118 | @echo "Generating profiled $(pdf_arch) book for PDF..."
|
---|
| 119 | $(Q)xsltproc --nonet --stringparam profile.condition pdf \
|
---|
| 120 | --output $(RENDERTMP)/$(pdf_arch)-pdf.xml \
|
---|
| 121 | $(PWD)/stylesheets/lfs-xsl/profile.xsl \
|
---|
| 122 | $(RENDERTMP)/$(pdf_arch)-full.xml
|
---|
| 123 |
|
---|
| 124 | @echo "Generating FO file of $(pdf_arch)..."
|
---|
| 125 | $(Q)xsltproc --nonet -stringparam rootid "$(ROOT_ID)" \
|
---|
| 126 | --output $(RENDERTMP)/$(pdf_arch).fo $(PWD)/stylesheets/clfs-pdf.xsl \
|
---|
| 127 | $(RENDERTMP)/$(pdf_arch)-pdf.xml
|
---|
| 128 | $(Q)sed -i -e 's/span="inherit"/span="all"/' $(RENDERTMP)/$(pdf_arch).fo
|
---|
[02095ae] | 129 |
|
---|
[b7f86eb] | 130 | @echo "Rendering PDF of $(pdf_arch)..."
|
---|
| 131 | $(Q)fop $(RENDERTMP)/$(pdf_arch).fo $(BASEDIR)/CLFS-EMBEDDED-$(pdf_arch).pdf
|
---|
[02095ae] | 132 |
|
---|
| 133 | validate: $(ARCHS_VALIDATE)
|
---|
| 134 |
|
---|
| 135 | $(ARCHS_VALIDATE): override validate_arch = $(@:%$(S)validate=%)
|
---|
| 136 | $(ARCHS_VALIDATE):
|
---|
| 137 | @echo "Validating $(validate_arch)..."
|
---|
[b7f86eb] | 138 | $(Q)xmllint --xinclude --noout --nonet --postvalid $(PWD)/$(validate_arch)-index.xml
|
---|
[02095ae] | 139 |
|
---|
| 140 | trouble: $(ARCHS_TROUBLE)
|
---|
| 141 |
|
---|
| 142 | $(ARCHS_TROUBLE): override trouble_arch = $(@:%$(S)trouble=%)
|
---|
| 143 | $(ARCHS_TROUBLE):
|
---|
| 144 | @echo "Troubleshooting $(trouble_arch)..."
|
---|
[b7f86eb] | 145 | $(Q)xmllint --xinclude --nonet --postvalid \
|
---|
| 146 | -o $(RENDERTMP)/dump-$(trouble_arch) $(PWD)/$(trouble_arch)-index.xml
|
---|
| 147 | $(Q)xmllint --xinclude --noout --nonet --valid $(RENDERTMP)/dump-$(trouble_arch)
|
---|
| 148 | @echo "You can now look at $(RENDERTMP)/dump-$(trouble_arch) to see the errors"
|
---|
[02095ae] | 149 |
|
---|
| 150 | dump-commands: $(ARCHS_DUMP)
|
---|
| 151 |
|
---|
| 152 | $(ARCHS_DUMP): override dump_arch = $(@:%$(S)dump=%)
|
---|
| 153 | $(ARCHS_DUMP):
|
---|
| 154 | @echo "Extracting commands from $(dump_arch)..."
|
---|
[b7f86eb] | 155 | $(Q)xsltproc --xinclude --nonet --output $(DUMPDIR)/$(dump_arch)/ \
|
---|
| 156 | $(PWD)/stylesheets/dump-commands.xsl $(PWD)/$(dump_arch)-index.xml
|
---|
[02095ae] | 157 |
|
---|
| 158 | download-list: $(ARCHS_DLLIST)
|
---|
| 159 |
|
---|
| 160 | $(ARCHS_DLLIST): override dllist_arch = $(@:%$(S)dllist=%)
|
---|
| 161 | $(ARCHS_DLLIST):
|
---|
| 162 | @echo "Creating download list for $(dllist_arch)..."
|
---|
[b7f86eb] | 163 | $(Q)xsltproc --xinclude --nonet --output $(DLLISTDIR)/$(dllist_arch).dl.list \
|
---|
| 164 | $(PWD)/stylesheets/wget.xsl $(PWD)/$(dllist_arch)-index.xml
|
---|
[02095ae] | 165 |
|
---|
| 166 | help:
|
---|
| 167 | @echo "HTML Targets"
|
---|
| 168 | @echo -e " \e[0;32mlfs tidy render titlepage \e[0;34m$(ARCHS_HTML)\e[0;0m"
|
---|
| 169 | @echo
|
---|
| 170 | @echo "NoChunks Targets"
|
---|
| 171 | @echo -e " \e[0;32mnochunks tidy \e[0;34m$(ARCHS_NOCHUNKS)\e[0;0m"
|
---|
| 172 | @echo
|
---|
| 173 | @echo "PDF Targets"
|
---|
| 174 | @echo -e " \e[0;32mpdf \e[0;34m$(ARCHS_PDF)\e[0;0m"
|
---|
| 175 | @echo
|
---|
| 176 | @echo "Validate Targets"
|
---|
| 177 | @echo -e " \e[0;32mvalidate \e[0;34m$(ARCHS_VALIDATE)\e[0;0m"
|
---|
| 178 | @echo
|
---|
| 179 | @echo "Trouble Targets"
|
---|
| 180 | @echo -e " \e[0;32mtrouble \e[0;34m$(ARCHS_TROUBLE)\e[0;0m"
|
---|
| 181 | @echo
|
---|
| 182 | @echo "Dump-Commands Targets"
|
---|
[8e23f7c] | 183 | @echo -e " \e[0;32mdump-commands \e[0;34m$(ARCHS_DUMP)\e[0;0m"
|
---|
[02095ae] | 184 | @echo
|
---|
| 185 | @echo "Download-List Targets"
|
---|
| 186 | @echo -e " \e[0;32mdownload-list \e[0;34m$(ARCHS_DLLIST)\e[0;0m"
|
---|