2005-06-23 18:29:46 +01:00
|
|
|
BASEDIR=~/lfs-book
|
2005-08-29 20:11:10 +01:00
|
|
|
DUMPDIR=~/lfs-commands
|
2007-07-05 23:35:05 +01:00
|
|
|
CHUNK_QUIET=1
|
|
|
|
ROOT_ID=""
|
2004-07-13 12:09:03 +01:00
|
|
|
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
|
|
|
|
|
2007-07-05 23:35:05 +01:00
|
|
|
lfs: validxml profile-html
|
|
|
|
@echo "Generating chunked XHTML files..."
|
2007-07-06 18:54:18 +01:00
|
|
|
$(Q)xsltproc --nonet -stringparam chunk.quietly $(CHUNK_QUIET) \
|
2007-07-05 23:35:05 +01:00
|
|
|
-stringparam rootid $(ROOT_ID) -stringparam base.dir $(BASEDIR)/ \
|
|
|
|
stylesheets/lfs-chunked.xsl /tmp/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; \
|
|
|
|
sh 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-05 23:35:05 +01:00
|
|
|
--output /tmp/lfs-pdf.xml stylesheets/lfs-xsl/profile.xsl \
|
|
|
|
/tmp/lfs-full.xml
|
|
|
|
|
|
|
|
@echo "Generating FO file..."
|
2007-07-06 18:54:18 +01:00
|
|
|
$(Q)xsltproc --nonet -stringparam rootid $(ROOT_ID) \
|
2007-07-05 23:35:05 +01:00
|
|
|
--output /tmp//lfs-pdf.fo stylesheets/lfs-pdf.xsl /tmp/lfs-pdf.xml
|
2007-07-06 18:54:18 +01:00
|
|
|
$(Q)sed -i -e 's/span="inherit"/span="all"/' /tmp/lfs-pdf.fo
|
2007-07-05 23:35:05 +01:00
|
|
|
|
|
|
|
@echo "Generating PDF file..."
|
2007-07-06 18:54:18 +01:00
|
|
|
$(Q)fop /tmp/lfs-pdf.fo $(BASEDIR)/$(PDF_OUTPUT)
|
2007-07-05 23:35:05 +01:00
|
|
|
|
|
|
|
nochunks: validxml profile-html
|
|
|
|
@echo "Generating non chunked XHTML file..."
|
2007-07-06 18:54:18 +01:00
|
|
|
$(Q)xsltproc --nonet -stringparam profile.condition html \
|
2007-07-05 23:35:05 +01:00
|
|
|
-stringparam rootid $(ROOT_ID) --output $(BASEDIR)/$(NOCHUNKS_OUTPUT) \
|
|
|
|
stylesheets/lfs-nochunks.xsl /tmp/lfs-html.xml
|
|
|
|
|
|
|
|
@echo "Running Tidy..."
|
2007-07-06 18:54:18 +01:00
|
|
|
$(Q)tidy -config tidy.conf $(BASEDIR)/$(NOCHUNKS_OUTPUT) || true
|
|
|
|
@echo "Running obfuscate.sh..."
|
|
|
|
$(Q)sh obfuscate.sh $(BASEDIR)/$(NOCHUNKS_OUTPUT)
|
|
|
|
$(Q)sed -i -e "s@text/html@application/xhtml+xml@g" \
|
2005-02-19 22:16:42 +00:00
|
|
|
$(BASEDIR)/$(NOCHUNKS_OUTPUT)
|
|
|
|
|
2007-07-05 23:35:05 +01:00
|
|
|
validxml:
|
|
|
|
@echo "Validating the book..."
|
2007-07-06 18:54:18 +01:00
|
|
|
$(Q)xmllint --nonet --noent --xinclude --postvalid \
|
2007-07-05 23:35:05 +01:00
|
|
|
-o /tmp/lfs-full.xml index.xml
|
|
|
|
|
|
|
|
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-05 23:35:05 +01:00
|
|
|
--output /tmp/lfs-html.xml stylesheets/lfs-xsl/profile.xsl \
|
|
|
|
/tmp/lfs-full.xml
|
|
|
|
|
|
|
|
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
|
|
|
|
|
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)/ \
|
|
|
|
stylesheets/dump-commands.xsl /tmp/lfs-full.xml
|
2005-08-29 20:11:10 +01:00
|
|
|
|
2004-05-03 11:33:11 +01:00
|
|
|
validate:
|
2007-07-05 23:35:05 +01:00
|
|
|
@echo "Validating the book..."
|
2007-07-06 18:54:18 +01:00
|
|
|
$(Q)xmllint --noout --nonet --xinclude --postvalid index.xml
|
2007-07-05 23:35:05 +01:00
|
|
|
|
|
|
|
all: lfs nochunks pdf dump-commands
|
2004-08-10 20:20:54 +01:00
|
|
|
|
2007-07-05 23:35:05 +01:00
|
|
|
.PHONY : all dump-commands lfs nochunks pdf profile-html validate validxml wget-list
|