Update to Module-Init-Tools-3.12
[linux_from_scratch.git] / Makefile
blob7914fe2ee07822d6d162b1e14801b88ceca98666
1 BASEDIR = ~/lfs-book
2 DUMPDIR = ~/lfs-commands
3 RENDERTMP = $(HOME)/tmp
4 CHUNK_QUIET = 1
5 ROOT_ID =
6 PDF_OUTPUT = LFS-BOOK.pdf
7 NOCHUNKS_OUTPUT = LFS-BOOK.html
9 ifdef V
10 Q =
11 else
12 Q = @
13 endif
15 lfs: maketar validxml profile-html
16 @echo "Generating chunked XHTML files..."
17 $(Q)xsltproc --nonet -stringparam chunk.quietly $(CHUNK_QUIET) \
18 -stringparam rootid "$(ROOT_ID)" -stringparam base.dir $(BASEDIR)/ \
19 stylesheets/lfs-chunked.xsl $(RENDERTMP)/lfs-html.xml
21 @echo "Copying CSS code and images..."
22 $(Q)if [ ! -e $(BASEDIR)/stylesheets ]; then \
23 mkdir -p $(BASEDIR)/stylesheets; \
24 fi;
25 $(Q)cp stylesheets/lfs-xsl/*.css $(BASEDIR)/stylesheets
26 $(Q)if [ ! -e $(BASEDIR)/images ]; then \
27 mkdir -p $(BASEDIR)/images; \
28 fi;
29 $(Q)cp images/*.png $(BASEDIR)/images
30 $(Q)cd $(BASEDIR)/; sed -i -e "s@../stylesheets@stylesheets@g" *.html
31 $(Q)cd $(BASEDIR)/; sed -i -e "s@../images@images@g" *.html
33 @echo "Running Tidy and obfuscate.sh..."
34 $(Q)for filename in `find $(BASEDIR) -name "*.html"`; do \
35 tidy -config tidy.conf $$filename; \
36 true; \
37 /bin/bash obfuscate.sh $$filename; \
38 sed -i -e "s@text/html@application/xhtml+xml@g" $$filename; \
39 done;
41 $(Q)$(MAKE) wget-list
43 pdf: validxml
44 @echo "Generating profiled XML for PDF..."
45 $(Q)xsltproc --nonet --stringparam profile.condition pdf \
46 --output $(RENDERTMP)/lfs-pdf.xml stylesheets/lfs-xsl/profile.xsl \
47 $(RENDERTMP)/lfs-full.xml
49 @echo "Generating FO file..."
50 $(Q)xsltproc --nonet -stringparam rootid "$(ROOT_ID)" \
51 --output $(RENDERTMP)/lfs-pdf.fo stylesheets/lfs-pdf.xsl \
52 $(RENDERTMP)/lfs-pdf.xml
53 $(Q)sed -i -e 's/span="inherit"/span="all"/' $(RENDERTMP)/lfs-pdf.fo
54 $(Q)bash pdf-fixups.sh $(RENDERTMP)/lfs-pdf.fo
56 @echo "Generating PDF file..."
57 $(Q)if [ ! -e $(BASEDIR) ]; then \
58 mkdir -p $(BASEDIR); \
59 fi;
60 $(Q)fop $(RENDERTMP)/lfs-pdf.fo $(BASEDIR)/$(PDF_OUTPUT)
62 nochunks: maketar validxml profile-html
63 @echo "Generating non chunked XHTML file..."
64 $(Q)xsltproc --nonet -stringparam rootid "$(ROOT_ID)" \
65 --output $(BASEDIR)/$(NOCHUNKS_OUTPUT) \
66 stylesheets/lfs-nochunks.xsl $(RENDERTMP)/lfs-html.xml
68 @echo "Running Tidy..."
69 $(Q)tidy -config tidy.conf $(BASEDIR)/$(NOCHUNKS_OUTPUT) || true
70 @echo "Running obfuscate.sh..."
71 $(Q)bash obfuscate.sh $(BASEDIR)/$(NOCHUNKS_OUTPUT)
72 $(Q)sed -i -e "s@text/html@application/xhtml+xml@g" \
73 $(BASEDIR)/$(NOCHUNKS_OUTPUT)
75 tmpdir:
76 @echo "Creating and cleaning $(RENDERTMP)"
77 $(Q)[ -d $(RENDERTMP) ] || mkdir -p $(RENDERTMP)
78 $(Q)rm -f $(RENDERTMP)/lfs-{full,html,pdf}.xml
79 $(Q)rm -f $(RENDERTMP)/lfs-pdf.fo
81 validxml: tmpdir
82 @echo "Processing bootscripts..."
83 $(Q)bash process-scripts.sh
84 @echo "Validating the book..."
85 $(Q)xmllint --nonet --noent --xinclude --postvalid \
86 -o $(RENDERTMP)/lfs-full.xml index.xml
87 $(Q)rm -f appendices/*.script
88 $(Q)./aux-file-data.sh $(RENDERTMP)/lfs-full.xml
90 maketar:
91 @echo "Making tarballs..."
92 $(Q)sh make-aux-files.sh
94 profile-html: validxml
95 @echo "Generating profiled XML for XHTML..."
96 $(Q)xsltproc --nonet --stringparam profile.condition html \
97 --output $(RENDERTMP)/lfs-html.xml stylesheets/lfs-xsl/profile.xsl \
98 $(RENDERTMP)/lfs-full.xml
100 wget-list:
101 @echo "Generating wget list..."
102 $(Q)mkdir -p $(BASEDIR)
103 $(Q)xsltproc --xinclude --nonet --output $(BASEDIR)/wget-list \
104 stylesheets/wget-list.xsl chapter03/chapter03.xml
106 dump-commands: validxml
107 @echo "Dumping book commands..."
108 $(Q)xsltproc --output $(DUMPDIR)/ \
109 stylesheets/dump-commands.xsl $(RENDERTMP)/lfs-full.xml
111 validate: maketar validxml
112 @echo "Validation complete."
114 all: lfs nochunks pdf dump-commands
116 .PHONY : all dump-commands lfs nochunks pdf profile-html tmpdir validate \
117 validxml wget-list maketar