source: BOOK/Makefile@ fd34dc3

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since fd34dc3 was 3dd76dac, checked in by Joe Ciccone <jciccone@…>, 15 years ago

Fixed an issue in the makefile with rendering of PDFs.
Thanks to Mark Pokorny for providing a patch for this.

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