[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)
|
---|
[122ebf0] | 62 | $(Q)xmllint --nonet --noent --xinclude --postvalid \
|
---|
[a94e338] | 63 | -o $(VALIDATEDIR)/$(arch)-full.xml \
|
---|
| 64 | $(PWD)/$(arch)-index.xml
|
---|
| 65 |
|
---|
| 66 | ARCHS_P_XML := $(ARCHS:%=%-profiled-xml)
|
---|
| 67 | .PHONY: $(ARCHS_P_XML)
|
---|
| 68 | $(ARCHS_P_XML): override arch = $(@:%-profiled-xml=%)
|
---|
| 69 | $(ARCHS_P_XML):
|
---|
| 70 | @$(MAKE) --no-print-directory $(arch)-validate_dump-xml
|
---|
| 71 | @echo "Generating profiled $(arch) book..."
|
---|
| 72 | $(Q)mkdir -p $(PROFILEDIR)
|
---|
[122ebf0] | 73 | $(Q)xsltproc --nonet --stringparam profile.condition html \
|
---|
[a94e338] | 74 | --output $(PROFILEDIR)/$(arch)-html.xml \
|
---|
| 75 | $(PWD)/stylesheets/lfs-xsl/profile.xsl \
|
---|
| 76 | $(VALIDATEDIR)/$(arch)-full.xml
|
---|
[122ebf0] | 77 |
|
---|
[a94e338] | 78 | ARCHS_HTML := $(ARCHS:%=%-html)
|
---|
| 79 | .PHONY: html render $(ARCHS_HTML)
|
---|
| 80 | html render: $(ARCHS_HTML) titlepage
|
---|
| 81 | $(ARCHS_HTML): override arch = $(@:%-html=%)
|
---|
| 82 | $(ARCHS_HTML):
|
---|
| 83 | @$(MAKE) --no-print-directory $(arch)-profiled-xml
|
---|
| 84 |
|
---|
| 85 | @echo "Rendering chunked XHTML of $(arch)..."
|
---|
| 86 | $(Q)mkdir -p $(HTMLDIR)/$(arch)
|
---|
[122ebf0] | 87 | $(Q)xsltproc --nonet -stringparam chunk.quietly $(CHUNK_QUIET) \
|
---|
| 88 | -stringparam rootid "$(ROOT_ID)" \
|
---|
[a94e338] | 89 | -stringparam base.dir $(HTMLDIR)/$(arch)/ \
|
---|
| 90 | $(PWD)/stylesheets/clfs-chunked.xsl \
|
---|
| 91 | $(PROFILEDIR)/$(arch)-html.xml
|
---|
| 92 |
|
---|
| 93 | @echo "Copying CSS code and images for $(arch)..."
|
---|
| 94 | $(Q)mkdir -p $(HTMLDIR)/$(arch)/stylesheets
|
---|
| 95 | $(Q)cp $(PWD)/stylesheets/lfs-xsl/*.css $(HTMLDIR)/$(arch)/stylesheets
|
---|
| 96 | $(Q)sed -i -e "s@../stylesheets@stylesheets@g" $(HTMLDIR)/$(arch)/*.html
|
---|
| 97 | $(Q)mkdir -p $(HTMLDIR)/$(arch)/images
|
---|
| 98 | $(Q)cp $(PWD)/images/*.png $(HTMLDIR)/$(arch)/images
|
---|
| 99 | $(Q)sed -i -e "s@../images@images@g" $(HTMLDIR)/$(arch)/*.html
|
---|
| 100 |
|
---|
| 101 | @$(MAKE) --no-print-directory tidy-d TIDY_DIR=$(HTMLDIR)/$(arch)
|
---|
| 102 |
|
---|
| 103 | ARCHS_NOCHUNKS := $(ARCHS:%=%-nochunks)
|
---|
| 104 | .PHONY: nochunks $(ARCHS_NOCHUNKS)
|
---|
| 105 | nochunks: $(ARCHS_NOCHUNKS)
|
---|
| 106 | $(ARCHS_NOCHUNKS): override arch = $(@:%-nochunks=%)
|
---|
[a9e389d] | 107 | $(ARCHS_NOCHUNKS):
|
---|
[a94e338] | 108 | @$(MAKE) --no-print-directory $(arch)-profiled-xml
|
---|
[122ebf0] | 109 |
|
---|
[a94e338] | 110 | @echo "Rendering Single File HTML of $(arch)..."
|
---|
| 111 | $(Q)mkdir -p $(NOCHUNKDIR)
|
---|
[122ebf0] | 112 | $(Q)xsltproc --nonet -stringparam rootid "$(ROOT_ID)" \
|
---|
[a94e338] | 113 | --output $(NOCHUNKDIR)/CLFS-$(arch).html \
|
---|
| 114 | $(PWD)/stylesheets/clfs-nochunks.xsl \
|
---|
| 115 | $(PROFILEDIR)/$(arch)-html.xml
|
---|
[a9e389d] | 116 |
|
---|
[a94e338] | 117 | @$(MAKE) --no-print-directory tidy-f TIDY_FILE=$(NOCHUNKDIR)/CLFS-$(arch).html
|
---|
[a9e389d] | 118 |
|
---|
[a94e338] | 119 | ARCHS_FO := $(ARCHS:%=%-fo)
|
---|
| 120 | .PHONY: fo $(ARCHS_FO)
|
---|
| 121 | fo: $(ARCHS_FO)
|
---|
| 122 | $(ARCHS_FO): override arch = $(@:%-fo=%)
|
---|
| 123 | $(ARCHS_FO):
|
---|
| 124 | @$(MAKE) --no-print-directory $(arch)-profiled-xml
|
---|
[122ebf0] | 125 |
|
---|
[a94e338] | 126 | @echo "Generating FO file of $(arch)..."
|
---|
| 127 | @mkdir -p $(FODIR)
|
---|
[122ebf0] | 128 | $(Q)xsltproc --nonet -stringparam rootid "$(ROOT_ID)" \
|
---|
[a94e338] | 129 | --output $(FODIR)/$(arch).fo \
|
---|
| 130 | $(PWD)/stylesheets/clfs-pdf.xsl \
|
---|
| 131 | $(PROFILEDIR)/$(arch)-html.xml
|
---|
| 132 | $(Q)sed -i -e 's/span="inherit"/span="all"/' $(FODIR)/$(arch).fo
|
---|
| 133 |
|
---|
| 134 | ARCHS_PDF := $(ARCHS:%=%-pdf)
|
---|
| 135 | .PHONY: pdf $(ARCHS_PDF)
|
---|
| 136 | pdf: $(ARCHS_PDF)
|
---|
| 137 | $(ARCHS_PDF): override arch = $(@:%-pdf=%)
|
---|
| 138 | $(ARCHS_PDF):
|
---|
| 139 | @$(MAKE) --no-print-directory $(arch)-fo
|
---|
[a9e389d] | 140 |
|
---|
[a94e338] | 141 | @echo "Rendering PDF of $(arch)..."
|
---|
| 142 | $(Q)mkdir -p $(PDFDIR)
|
---|
| 143 | $(Q)fop $(FODIR)/$(arch).fo $(PDFDIR)/CLFS-$(arch).pdf
|
---|
[a9e389d] | 144 |
|
---|
[a94e338] | 145 | ARCHS_VALIDATE := $(ARCHS:%=%-validate)
|
---|
| 146 | .PHONY: validate $(ARCHS_VALIDATE)
|
---|
[a9e389d] | 147 | validate: $(ARCHS_VALIDATE)
|
---|
[a94e338] | 148 | $(ARCHS_VALIDATE): override arch = $(@:%-validate=%)
|
---|
[a9e389d] | 149 | $(ARCHS_VALIDATE):
|
---|
[a94e338] | 150 | @echo "Validating $(arch)..."
|
---|
| 151 | $(Q)xmllint --xinclude --noout \
|
---|
| 152 | --nonet --postvalid \
|
---|
| 153 | $(PWD)/$(arch)-index.xml
|
---|
| 154 |
|
---|
| 155 | ARCHS_TROUBLE := $(ARCHS:%=%-trouble)
|
---|
| 156 | .PHONY: trouble $(ARCHS_TROUBLE)
|
---|
| 157 | trouble: $(ARCHS_TROUBLE)
|
---|
| 158 | $(ARCHS_TROUBLE): override arch = $(@:%-trouble=%)
|
---|
[a9e389d] | 159 | $(ARCHS_TROUBLE):
|
---|
[a94e338] | 160 | @echo "Troubleshooting $(arch)..."
|
---|
| 161 | @mkdir -p $(TROUBLEDIR)
|
---|
[122ebf0] | 162 | $(Q)xmllint --xinclude --nonet --postvalid \
|
---|
[a94e338] | 163 | -o $(TROUBLEDIR)/dump-$(arch) \
|
---|
| 164 | $(PWD)/$(arch)-index.xml
|
---|
| 165 | $(Q)xmllint --xinclude --noout --nonet --valid \
|
---|
| 166 | $(TROUBLEDIR)/dump-$(arch)
|
---|
| 167 | @echo "You can now look at $(TROUBLEDIR)/dump-$(arch) to see the errors"
|
---|
| 168 |
|
---|
| 169 | ARCHS_DUMP := $(ARCHS:%=%-dump)
|
---|
| 170 | .PHONY: dump-commands $(ARCHS_DUMP)
|
---|
[a9e389d] | 171 | dump-commands: $(ARCHS_DUMP)
|
---|
[a94e338] | 172 | $(ARCHS_DUMP): override arch = $(@:%-dump=%)
|
---|
[a9e389d] | 173 | $(ARCHS_DUMP):
|
---|
[a94e338] | 174 | @echo "Extracting commands from $(arch)..."
|
---|
| 175 | $(Q)mkdir -p $(DUMPDIR)/$(arch)
|
---|
| 176 | $(Q)xsltproc --xinclude --nonet \
|
---|
| 177 | --output $(DUMPDIR)/$(arch)/ \
|
---|
| 178 | $(PWD)/stylesheets/dump-commands.xsl \
|
---|
| 179 | $(PWD)/$(arch)-index.xml
|
---|
| 180 |
|
---|
| 181 | ARCHS_DLLIST := $(ARCHS:%=%-dllist)
|
---|
| 182 | .PHONY: download-list $(ARCHS_DLLIST)
|
---|
[a9e389d] | 183 | download-list: $(ARCHS_DLLIST)
|
---|
[a94e338] | 184 | $(ARCHS_DLLIST): override arch = $(@:%-dllist=%)
|
---|
[a9e389d] | 185 | $(ARCHS_DLLIST):
|
---|
[a94e338] | 186 | @echo "Creating download list for $(arch)..."
|
---|
[a6966fa] | 187 | $(Q)mkdir -p $(DLLISTDIR)
|
---|
[a94e338] | 188 | $(Q)xsltproc --xinclude --nonet \
|
---|
| 189 | --output $(DLLISTDIR)/$(arch).list \
|
---|
| 190 | $(PWD)/stylesheets/wget.xsl \
|
---|
| 191 | $(PWD)/$(arch)-index.xml
|
---|
| 192 |
|
---|
| 193 | FG_GREEN := $(shell echo -e '\e[0;32m')
|
---|
| 194 | FG_BLUE := $(shell echo -e '\e[0;34m')
|
---|
| 195 | FG_DEFAULT := $(shell echo -e '\e[0;0m')
|
---|
[a9e389d] | 196 | help:
|
---|
[a94e338] | 197 | @echo "Output: $(RENDERDIR)"
|
---|
| 198 | @echo
|
---|
[a9e389d] | 199 | @echo "HTML Targets"
|
---|
[a94e338] | 200 | @echo " $(FG_GREEN)clfs lfs tidy html render titlepage $(FG_BLUE)$(ARCHS_HTML)$(FG_DEFAULT)"
|
---|
[a9e389d] | 201 | @echo
|
---|
| 202 | @echo "NoChunks Targets"
|
---|
[a94e338] | 203 | @echo " $(FG_GREEN)nochunks tidy $(FG_BLUE)$(ARCHS_NOCHUNKS)$(FG_DEFAULT)"
|
---|
| 204 | @echo
|
---|
| 205 | @echo "FO Targets"
|
---|
| 206 | @echo " $(FG_GREEN)fo $(FG_BLUE)$(ARCHS_FO)$(FG_DEFAULT)"
|
---|
[a9e389d] | 207 | @echo
|
---|
| 208 | @echo "PDF Targets"
|
---|
[a94e338] | 209 | @echo " $(FG_GREEN)pdf $(FG_BLUE)$(ARCHS_PDF)$(FG_DEFAULT)"
|
---|
[a9e389d] | 210 | @echo
|
---|
| 211 | @echo "Validate Targets"
|
---|
[a94e338] | 212 | @echo " $(FG_GREEN)validate $(FG_BLUE)$(ARCHS_VALIDATE)$(FG_DEFAULT)"
|
---|
[a9e389d] | 213 | @echo
|
---|
| 214 | @echo "Trouble Targets"
|
---|
[a94e338] | 215 | @echo " $(FG_GREEN)trouble $(FG_BLUE)$(ARCHS_TROUBLE)$(FG_DEFAULT)"
|
---|
[a9e389d] | 216 | @echo
|
---|
| 217 | @echo "Dump-Commands Targets"
|
---|
[a94e338] | 218 | @echo " $(FG_GREEN)dump-commands $(FG_BLUE)$(ARCHS_DUMP)$(FG_DEFAULT)"
|
---|
[a9e389d] | 219 | @echo
|
---|
| 220 | @echo "Download-List Targets"
|
---|
[a94e338] | 221 | @echo " $(FG_GREEN)download-list $(FG_BLUE)$(ARCHS_DLLIST)$(FG_DEFAULT)"
|
---|