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