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