2007-07-10 20:17:18 +01:00
|
|
|
BASEDIR = ~/lfs-book
|
|
|
|
DUMPDIR = ~/lfs-commands
|
|
|
|
RENDERTMP = $(HOME)/tmp
|
|
|
|
CHUNK_QUIET = 1
|
|
|
|
ROOT_ID =
|
|
|
|
PDF_OUTPUT = LFS-BOOK.pdf
|
|
|
|
NOCHUNKS_OUTPUT = LFS-BOOK.html
|
2006-12-04 04:48:25 +00:00
|
|
|
|
2007-07-06 18:54:18 +01:00
|
|
|
ifdef V
|
|
|
|
Q =
|
|
|
|
else
|
|
|
|
Q = @
|
|
|
|
endif
|
|
|
|
|
2008-06-03 22:51:14 +01:00
|
|
|
lfs: maketar validxml profile-html
|
2007-07-05 23:35:05 +01:00
|
|
|
@echo "Generating chunked XHTML files..."
|
2007-07-06 18:54:18 +01:00
|
|
|
$(Q)xsltproc --nonet -stringparam chunk.quietly $(CHUNK_QUIET) \
|
2007-07-10 20:17:18 +01:00
|
|
|
-stringparam rootid "$(ROOT_ID)" -stringparam base.dir $(BASEDIR)/ \
|
2007-07-07 21:46:44 +01:00
|
|
|
stylesheets/lfs-chunked.xsl $(RENDERTMP)/lfs-html.xml
|
2004-05-03 11:33:11 +01:00
|
|
|
|
2007-07-05 23:35:05 +01:00
|
|
|
@echo "Copying CSS code and images..."
|
2007-07-06 18:54:18 +01:00
|
|
|
$(Q)if [ ! -e $(BASEDIR)/stylesheets ]; then \
|
2004-07-13 12:09:03 +01:00
|
|
|
mkdir -p $(BASEDIR)/stylesheets; \
|
|
|
|
fi;
|
2007-07-06 18:54:18 +01:00
|
|
|
$(Q)cp stylesheets/lfs-xsl/*.css $(BASEDIR)/stylesheets
|
|
|
|
$(Q)if [ ! -e $(BASEDIR)/images ]; then \
|
2004-07-13 12:09:03 +01:00
|
|
|
mkdir -p $(BASEDIR)/images; \
|
|
|
|
fi;
|
2007-07-06 18:54:18 +01:00
|
|
|
$(Q)cp images/*.png $(BASEDIR)/images
|
|
|
|
$(Q)cd $(BASEDIR)/; sed -i -e "s@../stylesheets@stylesheets@g" *.html
|
|
|
|
$(Q)cd $(BASEDIR)/; sed -i -e "s@../images@images@g" *.html
|
2004-05-03 11:33:11 +01:00
|
|
|
|
2007-07-06 18:54:18 +01:00
|
|
|
@echo "Running Tidy and obfuscate.sh..."
|
|
|
|
$(Q)for filename in `find $(BASEDIR) -name "*.html"`; do \
|
2005-07-26 20:42:52 +01:00
|
|
|
tidy -config tidy.conf $$filename; \
|
|
|
|
true; \
|
2008-01-27 17:24:19 +00:00
|
|
|
/bin/bash obfuscate.sh $$filename; \
|
2004-09-15 20:37:05 +01:00
|
|
|
sed -i -e "s@text/html@application/xhtml+xml@g" $$filename; \
|
|
|
|
done;
|
2006-12-04 10:08:02 +00:00
|
|
|
|
2007-07-06 18:54:18 +01:00
|
|
|
$(Q)$(MAKE) wget-list
|
2006-12-04 04:48:25 +00:00
|
|
|
|
2007-07-05 23:35:05 +01:00
|
|
|
pdf: validxml
|
|
|
|
@echo "Generating profiled XML for PDF..."
|
2007-07-06 18:54:18 +01:00
|
|
|
$(Q)xsltproc --nonet --stringparam profile.condition pdf \
|
2007-07-07 21:46:44 +01:00
|
|
|
--output $(RENDERTMP)/lfs-pdf.xml stylesheets/lfs-xsl/profile.xsl \
|
|
|
|
$(RENDERTMP)/lfs-full.xml
|
2007-07-05 23:35:05 +01:00
|
|
|
|
|
|
|
@echo "Generating FO file..."
|
2007-07-10 20:17:18 +01:00
|
|
|
$(Q)xsltproc --nonet -stringparam rootid "$(ROOT_ID)" \
|
2007-07-07 21:46:44 +01:00
|
|
|
--output $(RENDERTMP)/lfs-pdf.fo stylesheets/lfs-pdf.xsl \
|
|
|
|
$(RENDERTMP)/lfs-pdf.xml
|
|
|
|
$(Q)sed -i -e 's/span="inherit"/span="all"/' $(RENDERTMP)/lfs-pdf.fo
|
2009-11-24 18:22:00 +00:00
|
|
|
$(Q)bash pdf-fixups.sh $(RENDERTMP)/lfs-pdf.fo
|
2007-07-05 23:35:05 +01:00
|
|
|
|
|
|
|
@echo "Generating PDF file..."
|
2007-07-06 22:04:55 +01:00
|
|
|
$(Q)if [ ! -e $(BASEDIR) ]; then \
|
|
|
|
mkdir -p $(BASEDIR); \
|
|
|
|
fi;
|
2007-07-07 21:46:44 +01:00
|
|
|
$(Q)fop $(RENDERTMP)/lfs-pdf.fo $(BASEDIR)/$(PDF_OUTPUT)
|
2007-07-05 23:35:05 +01:00
|
|
|
|
2009-06-12 06:20:23 +01:00
|
|
|
nochunks: maketar validxml profile-html
|
2007-07-05 23:35:05 +01:00
|
|
|
@echo "Generating non chunked XHTML file..."
|
2007-07-10 20:17:18 +01:00
|
|
|
$(Q)xsltproc --nonet -stringparam rootid "$(ROOT_ID)" \
|
2007-07-07 15:51:38 +01:00
|
|
|
--output $(BASEDIR)/$(NOCHUNKS_OUTPUT) \
|
2007-07-07 21:46:44 +01:00
|
|
|
stylesheets/lfs-nochunks.xsl $(RENDERTMP)/lfs-html.xml
|
2007-07-05 23:35:05 +01:00
|
|
|
|
|
|
|
@echo "Running Tidy..."
|
2007-07-06 18:54:18 +01:00
|
|
|
$(Q)tidy -config tidy.conf $(BASEDIR)/$(NOCHUNKS_OUTPUT) || true
|
|
|
|
@echo "Running obfuscate.sh..."
|
2008-07-16 20:12:53 +01:00
|
|
|
$(Q)bash obfuscate.sh $(BASEDIR)/$(NOCHUNKS_OUTPUT)
|
2007-07-06 18:54:18 +01:00
|
|
|
$(Q)sed -i -e "s@text/html@application/xhtml+xml@g" \
|
2005-02-19 22:16:42 +00:00
|
|
|
$(BASEDIR)/$(NOCHUNKS_OUTPUT)
|
2011-11-01 22:02:13 +00:00
|
|
|
$(Q)sed -i -e "s@../wget-list@wget-list@" \
|
|
|
|
$(BASEDIR)/$(NOCHUNKS_OUTPUT)
|
|
|
|
$(Q)$(MAKE) wget-list
|
2005-02-19 22:16:42 +00:00
|
|
|
|
2007-07-07 21:46:44 +01:00
|
|
|
tmpdir:
|
|
|
|
@echo "Creating and cleaning $(RENDERTMP)"
|
|
|
|
$(Q)[ -d $(RENDERTMP) ] || mkdir -p $(RENDERTMP)
|
|
|
|
$(Q)rm -f $(RENDERTMP)/lfs-{full,html,pdf}.xml
|
|
|
|
$(Q)rm -f $(RENDERTMP)/lfs-pdf.fo
|
|
|
|
|
|
|
|
validxml: tmpdir
|
2008-06-03 22:51:14 +01:00
|
|
|
@echo "Processing bootscripts..."
|
2009-01-21 04:21:02 +00:00
|
|
|
$(Q)bash process-scripts.sh
|
2007-07-05 23:35:05 +01:00
|
|
|
@echo "Validating the book..."
|
2007-07-06 18:54:18 +01:00
|
|
|
$(Q)xmllint --nonet --noent --xinclude --postvalid \
|
2007-07-07 21:46:44 +01:00
|
|
|
-o $(RENDERTMP)/lfs-full.xml index.xml
|
2008-06-03 22:51:14 +01:00
|
|
|
$(Q)rm -f appendices/*.script
|
2008-11-22 14:02:23 +00:00
|
|
|
$(Q)./aux-file-data.sh $(RENDERTMP)/lfs-full.xml
|
2008-06-03 22:51:14 +01:00
|
|
|
|
|
|
|
maketar:
|
2011-10-09 20:52:48 +01:00
|
|
|
$(Q)if [ "x$(MAKETAR)" == "x" ]; then \
|
|
|
|
echo "Making tarballs..."; \
|
|
|
|
sh make-aux-files.sh; \
|
|
|
|
fi;
|
2007-07-05 23:35:05 +01:00
|
|
|
|
|
|
|
profile-html: validxml
|
|
|
|
@echo "Generating profiled XML for XHTML..."
|
2007-07-06 18:54:18 +01:00
|
|
|
$(Q)xsltproc --nonet --stringparam profile.condition html \
|
2007-07-07 21:46:44 +01:00
|
|
|
--output $(RENDERTMP)/lfs-html.xml stylesheets/lfs-xsl/profile.xsl \
|
|
|
|
$(RENDERTMP)/lfs-full.xml
|
2007-07-05 23:35:05 +01:00
|
|
|
|
|
|
|
wget-list:
|
|
|
|
@echo "Generating wget list..."
|
2007-07-06 18:54:18 +01:00
|
|
|
$(Q)mkdir -p $(BASEDIR)
|
|
|
|
$(Q)xsltproc --xinclude --nonet --output $(BASEDIR)/wget-list \
|
2007-07-05 23:35:05 +01:00
|
|
|
stylesheets/wget-list.xsl chapter03/chapter03.xml
|
|
|
|
|
2011-10-08 03:12:06 +01:00
|
|
|
md5sums:
|
|
|
|
@echo "Generating md5sum file..."
|
|
|
|
$(Q)mkdir -p $(BASEDIR)
|
|
|
|
$(Q)xsltproc --xinclude --nonet --output $(BASEDIR)/md5sums \
|
|
|
|
stylesheets/md5sum.xsl chapter03/chapter03.xml
|
|
|
|
$(Q)sed -i -e "s/BOOTSCRIPTS-MD5SUM/$(shell md5sum lfs-bootscripts*.tar.bz2 | cut -d' ' -f1)/" \
|
|
|
|
$(BASEDIR)/md5sums
|
|
|
|
$(Q)sed -i -e "s/UDEV-MD5SUM/$(shell md5sum udev-config*.tar.bz2 | cut -d' ' -f1)/" \
|
|
|
|
$(BASEDIR)/md5sums
|
|
|
|
|
|
|
|
|
2007-07-06 18:54:18 +01:00
|
|
|
dump-commands: validxml
|
2007-07-05 23:35:05 +01:00
|
|
|
@echo "Dumping book commands..."
|
2007-07-06 18:54:18 +01:00
|
|
|
$(Q)xsltproc --output $(DUMPDIR)/ \
|
2007-07-07 21:46:44 +01:00
|
|
|
stylesheets/dump-commands.xsl $(RENDERTMP)/lfs-full.xml
|
2005-08-29 20:11:10 +01:00
|
|
|
|
2008-10-05 21:32:33 +01:00
|
|
|
validate: maketar validxml
|
2008-10-05 20:37:58 +01:00
|
|
|
@echo "Validation complete."
|
2007-07-05 23:35:05 +01:00
|
|
|
|
2011-10-08 03:12:06 +01:00
|
|
|
all: lfs nochunks pdf dump-commands md5sums
|
2004-08-10 20:20:54 +01:00
|
|
|
|
2007-07-07 21:46:44 +01:00
|
|
|
.PHONY : all dump-commands lfs nochunks pdf profile-html tmpdir validate \
|
2011-10-08 03:12:06 +01:00
|
|
|
validxml wget-list maketar md5sums
|