[a94e338] | 1 | TOP := $(PWD)
|
---|
| 2 | RENDERDIR := $(TOP)/../render
|
---|
[a9e389d] | 3 |
|
---|
[a94e338] | 4 | VALIDATEDIR := $(RENDERDIR)/validate
|
---|
| 5 | PROFILEDIR := $(RENDERDIR)/profile
|
---|
[a9e389d] | 6 |
|
---|
[a94e338] | 7 | HTMLDIR := $(RENDERDIR)/html
|
---|
| 8 | NOCHUNKDIR := $(RENDERDIR)/nochunk
|
---|
| 9 |
|
---|
| 10 | FODIR := $(RENDERDIR)/fo
|
---|
| 11 | PDFDIR := $(RENDERDIR)/pdf
|
---|
| 12 |
|
---|
| 13 | TROUBLEDIR := $(RENDERDIR)/trouble
|
---|
| 14 | DUMPDIR := $(RENDERDIR)/commands
|
---|
| 15 | DLLISTDIR := $(RENDERDIR)/download-list
|
---|
| 16 |
|
---|
| 17 | CHUNK_QUIET := 1
|
---|
| 18 | ROOT_ID :=
|
---|
[a9e389d] | 19 |
|
---|
[a94e338] | 20 | ARCHS := x86 mips wrt arm
|
---|
[a9e389d] | 21 |
|
---|
[122ebf0] | 22 | ifdef V
|
---|
| 23 | Q =
|
---|
| 24 | else
|
---|
| 25 | Q = @
|
---|
| 26 | endif
|
---|
| 27 |
|
---|
[a94e338] | 28 | .PHONY: clfs lfs
|
---|
| 29 | clfs lfs: html
|
---|
[a9e389d] | 30 |
|
---|
[a94e338] | 31 | .PHONY: tidy tidy-f tidy-d
|
---|
| 32 | ifeq ($(shell which tidy >/dev/null 2>&1 && echo yes),yes)
|
---|
| 33 | tidy:
|
---|
| 34 | @$(MAKE) --no-print-directory tidy-d TIDY_DIR=$(HTMLDIR)
|
---|
[122ebf0] | 35 |
|
---|
[a94e338] | 36 | tidy-f:
|
---|
| 37 | @echo "Running tidy on F:$(shell basename $(TIDY_FILE))"
|
---|
| 38 | @$(TOP)/tidy.sh "$(TIDY_FILE)"
|
---|
[a9e389d] | 39 |
|
---|
[a94e338] | 40 | tidy-d:
|
---|
| 41 | @echo "Running tidy on D:$(shell basename $(TIDY_DIR))"
|
---|
| 42 | @$(TOP)/tidy.sh "$(TIDY_DIR)"
|
---|
[a9e389d] | 43 | else
|
---|
[a94e338] | 44 | tidy tidy-f tidy-d:
|
---|
[122ebf0] | 45 | @echo "Tidy is not installed on this system"
|
---|
[a9e389d] | 46 | endif
|
---|
| 47 |
|
---|
[a94e338] | 48 | .PHONY: titlepage
|
---|
[a9e389d] | 49 | titlepage:
|
---|
[a94e338] | 50 | @echo "Rendering the top-level index..."
|
---|
| 51 | $(Q)xsltproc --nonet --output $(HTMLDIR)/index.html \
|
---|
| 52 | $(PWD)/stylesheets/top-index.xsl \
|
---|
| 53 | $(PWD)/index.xml
|
---|
| 54 | @$(MAKE) --no-print-directory tidy-f TIDY_FILE=$(HTMLDIR)/index.html
|
---|
| 55 |
|
---|
| 56 | ARCHS_VD_XML := $(ARCHS:%=%-validate_dump-xml)
|
---|
| 57 | .PHONY: $(ARCHS_VD_XML)
|
---|
| 58 | $(ARCHS_VD_XML): override arch = $(@:%-validate_dump-xml=%)
|
---|
| 59 | $(ARCHS_VD_XML):
|
---|
| 60 | @echo "Validating $(arch) book..."
|
---|
| 61 | $(Q)mkdir -p $(VALIDATEDIR)
|
---|
[64df749] | 62 | $(Q)xmllint --nonet --noent --xinclude \
|
---|
| 63 | --relaxng $(TOP)/schema/docbook/4.5/rng/docbook.rng \
|
---|
[a94e338] | 64 | -o $(VALIDATEDIR)/$(arch)-full.xml \
|
---|
| 65 | $(PWD)/$(arch)-index.xml
|
---|
| 66 |
|
---|
| 67 | ARCHS_P_XML := $(ARCHS:%=%-profiled-xml)
|
---|
| 68 | .PHONY: $(ARCHS_P_XML)
|
---|
| 69 | $(ARCHS_P_XML): override arch = $(@:%-profiled-xml=%)
|
---|
| 70 | $(ARCHS_P_XML):
|
---|
| 71 | @$(MAKE) --no-print-directory $(arch)-validate_dump-xml
|
---|
| 72 | @echo "Generating profiled $(arch) book..."
|
---|
| 73 | $(Q)mkdir -p $(PROFILEDIR)
|
---|
[122ebf0] | 74 | $(Q)xsltproc --nonet --stringparam profile.condition html \
|
---|
[a94e338] | 75 | --output $(PROFILEDIR)/$(arch)-html.xml \
|
---|
| 76 | $(PWD)/stylesheets/lfs-xsl/profile.xsl \
|
---|
| 77 | $(VALIDATEDIR)/$(arch)-full.xml
|
---|
[122ebf0] | 78 |
|
---|
[a94e338] | 79 | ARCHS_HTML := $(ARCHS:%=%-html)
|
---|
| 80 | .PHONY: html render $(ARCHS_HTML)
|
---|
| 81 | html render: $(ARCHS_HTML) titlepage
|
---|
| 82 | $(ARCHS_HTML): override arch = $(@:%-html=%)
|
---|
| 83 | $(ARCHS_HTML):
|
---|
| 84 | @$(MAKE) --no-print-directory $(arch)-profiled-xml
|
---|
| 85 |
|
---|
| 86 | @echo "Rendering chunked XHTML of $(arch)..."
|
---|
| 87 | $(Q)mkdir -p $(HTMLDIR)/$(arch)
|
---|
[122ebf0] | 88 | $(Q)xsltproc --nonet -stringparam chunk.quietly $(CHUNK_QUIET) \
|
---|
| 89 | -stringparam rootid "$(ROOT_ID)" \
|
---|
[a94e338] | 90 | -stringparam base.dir $(HTMLDIR)/$(arch)/ \
|
---|
| 91 | $(PWD)/stylesheets/clfs-chunked.xsl \
|
---|
| 92 | $(PROFILEDIR)/$(arch)-html.xml
|
---|
| 93 |
|
---|
| 94 | @echo "Copying CSS code and images for $(arch)..."
|
---|
| 95 | $(Q)mkdir -p $(HTMLDIR)/$(arch)/stylesheets
|
---|
| 96 | $(Q)cp $(PWD)/stylesheets/lfs-xsl/*.css $(HTMLDIR)/$(arch)/stylesheets
|
---|
| 97 | $(Q)sed -i -e "s@../stylesheets@stylesheets@g" $(HTMLDIR)/$(arch)/*.html
|
---|
| 98 | $(Q)mkdir -p $(HTMLDIR)/$(arch)/images
|
---|
| 99 | $(Q)cp $(PWD)/images/*.png $(HTMLDIR)/$(arch)/images
|
---|
| 100 | $(Q)sed -i -e "s@../images@images@g" $(HTMLDIR)/$(arch)/*.html
|
---|
| 101 |
|
---|
| 102 | @$(MAKE) --no-print-directory tidy-d TIDY_DIR=$(HTMLDIR)/$(arch)
|
---|
| 103 |
|
---|
| 104 | ARCHS_NOCHUNKS := $(ARCHS:%=%-nochunks)
|
---|
| 105 | .PHONY: nochunks $(ARCHS_NOCHUNKS)
|
---|
| 106 | nochunks: $(ARCHS_NOCHUNKS)
|
---|
| 107 | $(ARCHS_NOCHUNKS): override arch = $(@:%-nochunks=%)
|
---|
[a9e389d] | 108 | $(ARCHS_NOCHUNKS):
|
---|
[a94e338] | 109 | @$(MAKE) --no-print-directory $(arch)-profiled-xml
|
---|
[122ebf0] | 110 |
|
---|
[a94e338] | 111 | @echo "Rendering Single File HTML of $(arch)..."
|
---|
| 112 | $(Q)mkdir -p $(NOCHUNKDIR)
|
---|
[122ebf0] | 113 | $(Q)xsltproc --nonet -stringparam rootid "$(ROOT_ID)" \
|
---|
[a94e338] | 114 | --output $(NOCHUNKDIR)/CLFS-$(arch).html \
|
---|
| 115 | $(PWD)/stylesheets/clfs-nochunks.xsl \
|
---|
| 116 | $(PROFILEDIR)/$(arch)-html.xml
|
---|
[a9e389d] | 117 |
|
---|
[a94e338] | 118 | @$(MAKE) --no-print-directory tidy-f TIDY_FILE=$(NOCHUNKDIR)/CLFS-$(arch).html
|
---|
[a9e389d] | 119 |
|
---|
[a94e338] | 120 | ARCHS_FO := $(ARCHS:%=%-fo)
|
---|
| 121 | .PHONY: fo $(ARCHS_FO)
|
---|
| 122 | fo: $(ARCHS_FO)
|
---|
| 123 | $(ARCHS_FO): override arch = $(@:%-fo=%)
|
---|
| 124 | $(ARCHS_FO):
|
---|
| 125 | @$(MAKE) --no-print-directory $(arch)-profiled-xml
|
---|
[122ebf0] | 126 |
|
---|
[a94e338] | 127 | @echo "Generating FO file of $(arch)..."
|
---|
| 128 | @mkdir -p $(FODIR)
|
---|
[122ebf0] | 129 | $(Q)xsltproc --nonet -stringparam rootid "$(ROOT_ID)" \
|
---|
[a94e338] | 130 | --output $(FODIR)/$(arch).fo \
|
---|
| 131 | $(PWD)/stylesheets/clfs-pdf.xsl \
|
---|
| 132 | $(PROFILEDIR)/$(arch)-html.xml
|
---|
| 133 | $(Q)sed -i -e 's/span="inherit"/span="all"/' $(FODIR)/$(arch).fo
|
---|
| 134 |
|
---|
| 135 | ARCHS_PDF := $(ARCHS:%=%-pdf)
|
---|
| 136 | .PHONY: pdf $(ARCHS_PDF)
|
---|
| 137 | pdf: $(ARCHS_PDF)
|
---|
| 138 | $(ARCHS_PDF): override arch = $(@:%-pdf=%)
|
---|
| 139 | $(ARCHS_PDF):
|
---|
| 140 | @$(MAKE) --no-print-directory $(arch)-fo
|
---|
[a9e389d] | 141 |
|
---|
[a94e338] | 142 | @echo "Rendering PDF of $(arch)..."
|
---|
| 143 | $(Q)mkdir -p $(PDFDIR)
|
---|
| 144 | $(Q)fop $(FODIR)/$(arch).fo $(PDFDIR)/CLFS-$(arch).pdf
|
---|
[a9e389d] | 145 |
|
---|
[a94e338] | 146 | ARCHS_VALIDATE := $(ARCHS:%=%-validate)
|
---|
| 147 | .PHONY: validate $(ARCHS_VALIDATE)
|
---|
[a9e389d] | 148 | validate: $(ARCHS_VALIDATE)
|
---|
[a94e338] | 149 | $(ARCHS_VALIDATE): override arch = $(@:%-validate=%)
|
---|
[a9e389d] | 150 | $(ARCHS_VALIDATE):
|
---|
[a94e338] | 151 | @echo "Validating $(arch)..."
|
---|
[64df749] | 152 | $(Q)xmllint --xinclude --noout --nonet \
|
---|
| 153 | --relaxng $(TOP)/schema/docbook/4.5/rng/docbook.rng \
|
---|
[a94e338] | 154 | $(PWD)/$(arch)-index.xml
|
---|
| 155 |
|
---|
| 156 | ARCHS_TROUBLE := $(ARCHS:%=%-trouble)
|
---|
| 157 | .PHONY: trouble $(ARCHS_TROUBLE)
|
---|
| 158 | trouble: $(ARCHS_TROUBLE)
|
---|
| 159 | $(ARCHS_TROUBLE): override arch = $(@:%-trouble=%)
|
---|
[a9e389d] | 160 | $(ARCHS_TROUBLE):
|
---|
[a94e338] | 161 | @echo "Troubleshooting $(arch)..."
|
---|
| 162 | @mkdir -p $(TROUBLEDIR)
|
---|
[64df749] | 163 | $(Q)xmllint --xinclude --nonet \
|
---|
| 164 | --relaxng $(TOP)/schema/docbook/4.5/rng/docbook.rng \
|
---|
[a94e338] | 165 | -o $(TROUBLEDIR)/dump-$(arch) \
|
---|
| 166 | $(PWD)/$(arch)-index.xml
|
---|
[64df749] | 167 | $(Q)xmllint --xinclude --noout --nonet \
|
---|
| 168 | --relaxng $(TOP)/schema/docbook/4.5/rng/docbook.rng \
|
---|
[a94e338] | 169 | $(TROUBLEDIR)/dump-$(arch)
|
---|
| 170 | @echo "You can now look at $(TROUBLEDIR)/dump-$(arch) to see the errors"
|
---|
| 171 |
|
---|
| 172 | ARCHS_DUMP := $(ARCHS:%=%-dump)
|
---|
| 173 | .PHONY: dump-commands $(ARCHS_DUMP)
|
---|
[a9e389d] | 174 | dump-commands: $(ARCHS_DUMP)
|
---|
[a94e338] | 175 | $(ARCHS_DUMP): override arch = $(@:%-dump=%)
|
---|
[a9e389d] | 176 | $(ARCHS_DUMP):
|
---|
[a94e338] | 177 | @echo "Extracting commands from $(arch)..."
|
---|
| 178 | $(Q)mkdir -p $(DUMPDIR)/$(arch)
|
---|
| 179 | $(Q)xsltproc --xinclude --nonet \
|
---|
| 180 | --output $(DUMPDIR)/$(arch)/ \
|
---|
| 181 | $(PWD)/stylesheets/dump-commands.xsl \
|
---|
| 182 | $(PWD)/$(arch)-index.xml
|
---|
| 183 |
|
---|
| 184 | ARCHS_DLLIST := $(ARCHS:%=%-dllist)
|
---|
| 185 | .PHONY: download-list $(ARCHS_DLLIST)
|
---|
[a9e389d] | 186 | download-list: $(ARCHS_DLLIST)
|
---|
[a94e338] | 187 | $(ARCHS_DLLIST): override arch = $(@:%-dllist=%)
|
---|
[a9e389d] | 188 | $(ARCHS_DLLIST):
|
---|
[a94e338] | 189 | @echo "Creating download list for $(arch)..."
|
---|
[a6966fa] | 190 | $(Q)mkdir -p $(DLLISTDIR)
|
---|
[a94e338] | 191 | $(Q)xsltproc --xinclude --nonet \
|
---|
| 192 | --output $(DLLISTDIR)/$(arch).list \
|
---|
| 193 | $(PWD)/stylesheets/wget.xsl \
|
---|
| 194 | $(PWD)/$(arch)-index.xml
|
---|
| 195 |
|
---|
| 196 | FG_GREEN := $(shell echo -e '\e[0;32m')
|
---|
| 197 | FG_BLUE := $(shell echo -e '\e[0;34m')
|
---|
| 198 | FG_DEFAULT := $(shell echo -e '\e[0;0m')
|
---|
[a9e389d] | 199 | help:
|
---|
[a94e338] | 200 | @echo "Output: $(RENDERDIR)"
|
---|
| 201 | @echo
|
---|
[a9e389d] | 202 | @echo "HTML Targets"
|
---|
[a94e338] | 203 | @echo " $(FG_GREEN)clfs lfs tidy html render titlepage $(FG_BLUE)$(ARCHS_HTML)$(FG_DEFAULT)"
|
---|
[a9e389d] | 204 | @echo
|
---|
| 205 | @echo "NoChunks Targets"
|
---|
[a94e338] | 206 | @echo " $(FG_GREEN)nochunks tidy $(FG_BLUE)$(ARCHS_NOCHUNKS)$(FG_DEFAULT)"
|
---|
| 207 | @echo
|
---|
| 208 | @echo "FO Targets"
|
---|
| 209 | @echo " $(FG_GREEN)fo $(FG_BLUE)$(ARCHS_FO)$(FG_DEFAULT)"
|
---|
[a9e389d] | 210 | @echo
|
---|
| 211 | @echo "PDF Targets"
|
---|
[a94e338] | 212 | @echo " $(FG_GREEN)pdf $(FG_BLUE)$(ARCHS_PDF)$(FG_DEFAULT)"
|
---|
[a9e389d] | 213 | @echo
|
---|
| 214 | @echo "Validate Targets"
|
---|
[a94e338] | 215 | @echo " $(FG_GREEN)validate $(FG_BLUE)$(ARCHS_VALIDATE)$(FG_DEFAULT)"
|
---|
[a9e389d] | 216 | @echo
|
---|
| 217 | @echo "Trouble Targets"
|
---|
[a94e338] | 218 | @echo " $(FG_GREEN)trouble $(FG_BLUE)$(ARCHS_TROUBLE)$(FG_DEFAULT)"
|
---|
[a9e389d] | 219 | @echo
|
---|
| 220 | @echo "Dump-Commands Targets"
|
---|
[a94e338] | 221 | @echo " $(FG_GREEN)dump-commands $(FG_BLUE)$(ARCHS_DUMP)$(FG_DEFAULT)"
|
---|
[a9e389d] | 222 | @echo
|
---|
| 223 | @echo "Download-List Targets"
|
---|
[a94e338] | 224 | @echo " $(FG_GREEN)download-list $(FG_BLUE)$(ARCHS_DLLIST)$(FG_DEFAULT)"
|
---|