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
|
2012-01-07 17:47:27 +00:00
|
|
|
SHELL = /bin/bash
|
2006-12-04 04:48:25 +00:00
|
|
|
|
2007-07-06 18:54:18 +01:00
|
|
|
ifdef V
|
|
|
|
Q =
|
|
|
|
else
|
|
|
|
Q = @
|
|
|
|
endif
|
|
|
|
|
2012-03-05 20:16:58 +00:00
|
|
|
lfs: validate 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
|
2013-10-08 21:03:29 +01:00
|
|
|
# $(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
|
|
|
|
2013-05-07 19:48:07 +01:00
|
|
|
$(Q)$(MAKE) $(BASEDIR)/wget-list $(BASEDIR)/md5sums
|
2006-12-04 04:48:25 +00:00
|
|
|
|
2012-03-05 20:16:58 +00:00
|
|
|
pdf: validate
|
2007-07-05 23:35:05 +01:00
|
|
|
@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;
|
2012-12-18 23:52:58 +00:00
|
|
|
$(Q)fop -q $(RENDERTMP)/lfs-pdf.fo $(BASEDIR)/$(PDF_OUTPUT) 2>fop.log
|
|
|
|
@echo "$(BASEDIR)/$(PDF_OUTPUT) created"
|
|
|
|
@echo "fop.log created"
|
2007-07-05 23:35:05 +01:00
|
|
|
|
2012-03-05 20:16:58 +00:00
|
|
|
nochunks: validate 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..."
|
2013-05-07 19:48:07 +01:00
|
|
|
$(Q)bash obfuscate.sh $(BASEDIR)/$(NOCHUNKS_OUTPUT)
|
|
|
|
$(Q)sed -i -e "s@text/html@application/xhtml+xml@g" $(BASEDIR)/$(NOCHUNKS_OUTPUT)
|
|
|
|
$(Q)sed -i -e "s@../wget-list@wget-list@" $(BASEDIR)/$(NOCHUNKS_OUTPUT)
|
2013-11-19 21:48:09 +00:00
|
|
|
$(Q)sed -i -e "s@../md5sums@md5sums@" $(BASEDIR)/$(NOCHUNKS_OUTPUT)
|
2013-05-07 19:48:07 +01:00
|
|
|
$(Q)$(MAKE) $(BASEDIR)/wget-list $(BASEDIR)/md5sums
|
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
|
|
|
|
|
2012-03-05 20:16:58 +00:00
|
|
|
validate: 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
|
2012-03-05 20:16:58 +00:00
|
|
|
@echo "Validation complete."
|
2008-06-03 22:51:14 +01:00
|
|
|
|
2012-03-05 20:16:58 +00:00
|
|
|
profile-html: validate
|
2007-07-05 23:35:05 +01:00
|
|
|
@echo "Generating profiled XML for XHTML..."
|
2007-07-06 18:54:18 +01:00
|
|
|
$(Q)xsltproc --nonet --stringparam profile.condition html \
|
2013-05-07 19:48:07 +01:00
|
|
|
--output $(RENDERTMP)/lfs-html.xml stylesheets/lfs-xsl/profile.xsl \
|
|
|
|
$(RENDERTMP)/lfs-full.xml
|
2007-07-05 23:35:05 +01:00
|
|
|
|
2013-09-01 14:55:47 +01:00
|
|
|
wget-list: $(BASEDIR)/wget-list
|
|
|
|
$(BASEDIR)/wget-list: stylesheets/wget-list.xsl chapter03/chapter03.xml packages.ent patches.ent
|
2007-07-05 23:35:05 +01:00
|
|
|
@echo "Generating wget list..."
|
2007-07-06 18:54:18 +01:00
|
|
|
$(Q)mkdir -p $(BASEDIR)
|
|
|
|
$(Q)xsltproc --xinclude --nonet --output $(BASEDIR)/wget-list \
|
2013-05-07 19:48:07 +01:00
|
|
|
stylesheets/wget-list.xsl chapter03/chapter03.xml
|
2007-07-05 23:35:05 +01:00
|
|
|
|
2013-09-01 14:55:47 +01:00
|
|
|
md5sums: $(BASEDIR)/md5sums
|
|
|
|
$(BASEDIR)/md5sums: stylesheets/wget-list.xsl chapter03/chapter03.xml packages.ent patches.ent
|
2011-10-08 03:12:06 +01:00
|
|
|
@echo "Generating md5sum file..."
|
|
|
|
$(Q)mkdir -p $(BASEDIR)
|
|
|
|
$(Q)xsltproc --xinclude --nonet --output $(BASEDIR)/md5sums \
|
2013-05-07 19:48:07 +01:00
|
|
|
stylesheets/md5sum.xsl chapter03/chapter03.xml
|
|
|
|
$(Q)sed -i -e \
|
|
|
|
"s/BOOTSCRIPTS-MD5SUM/$(shell md5sum lfs-bootscripts*.tar.bz2 | cut -d' ' -f1)/" \
|
|
|
|
$(BASEDIR)/md5sums
|
2011-10-08 03:12:06 +01:00
|
|
|
|
2012-03-05 20:16:58 +00:00
|
|
|
dump-commands: validate
|
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
|
|
|
|
2007-07-05 23:35:05 +01:00
|
|
|
|
2013-05-07 19:48:07 +01:00
|
|
|
all: lfs nochunks pdf dump-commands
|
|
|
|
|
|
|
|
.PHONY : all dump-commands lfs nochunks pdf profile-html tmpdir validate
|
2004-08-10 20:20:54 +01:00
|
|
|
|