On Sat, Jul 07, 2007 at 05:04:39PM +0200, M.Canales.es wrote:
>
> That might be a solution. If opting by that, I prefer $(BASEDIR)/temp-files
> or
> something like that to keep it centralized.
OK, I wasn't sure about polluting $(BASEDIR). What do you think of this?
diff --git a/BOOK/Makefile b/BOOK/Makefile
index bbd8078..fda725a 100644
--- a/BOOK/Makefile
+++ b/BOOK/Makefile
@@ -5,12 +5,13 @@
# $Date$
# Adjust these to suit your installation
-BASEDIR= $(HOME)/public_html/blfs-book-xsl
-DUMPDIR= $(HOME)/blfs-commands
-CHUNK_QUIET=1
-ROOT_ID=""
-PDF_OUTPUT=BLFS-BOOK.pdf
-NOCHUNKS_OUTPUT=BLFS-BOOK.html
+BASEDIR = $(HOME)/public_html/blfs-book-xsl
+DUMPDIR = $(HOME)/blfs-commands
+RENDERDIR = $(BASEDIR)/tmp
+CHUNK_QUIET = 1
+ROOT_ID = ""
+PDF_OUTPUT = BLFS-BOOK.pdf
+NOCHUNKS_OUTPUT = BLFS-BOOK.html
ifdef V
Q =
@@ -18,11 +19,18 @@ else
Q = @
endif
-blfs: validxml profile-html
+clean:
+ @echo "Cleaning up..."
+ $(Q)rm -rf $(RENDERDIR)
+
+createdir:
+ $(Q)[ -d $(RENDERDIR) ] || mkdir -p $(RENDERDIR)
+
+blfs: createdir validxml profile-html
@echo "Generating chunked XHTML files..."
$(Q)xsltproc --nonet -stringparam chunk.quietly $(CHUNK_QUIET) \
-stringparam rootid $(ROOT_ID) -stringparam base.dir $(BASEDIR)/ \
- stylesheets/blfs-chunked.xsl /tmp/blfs-html.xml
+ stylesheets/blfs-chunked.xsl $(RENDERDIR)/blfs-html.xml
@echo "Copying CSS code and images..."
$(Q)if [ ! -e $(BASEDIR)/stylesheets ]; then \
@@ -44,28 +52,29 @@ blfs: validxml profile-html
sed -i -e "[EMAIL PROTECTED]/[EMAIL PROTECTED]/[EMAIL PROTECTED]"
$$filename; \
done;
-pdf: validxml
+pdf: createdir validxml
@echo "Generating profiled XML for PDF..."
$(Q)xsltproc --nonet --stringparam profile.condition pdf \
- --output /tmp/blfs-pdf.xml stylesheets/lfs-xsl/profile.xsl \
- /tmp/blfs-full.xml
+ --output $(RENDERDIR)/blfs-pdf.xml stylesheets/lfs-xsl/profile.xsl \
+ $(RENDERDIR)/blfs-full.xml
@echo "Generating FO file..."
$(Q)xsltproc --nonet -stringparam rootid $(ROOT_ID) \
- --output /tmp/blfs-pdf.fo stylesheets/blfs-pdf.xsl /tmp/blfs-pdf.xml
- $(Q)sed -i -e 's/span="inherit"/span="all"/' /tmp/blfs-pdf.fo
+ --output $(RENDERDIR)/blfs-pdf.fo stylesheets/blfs-pdf.xsl \
+ $(RENDERDIR)/blfs-pdf.xml
+ $(Q)sed -i -e 's/span="inherit"/span="all"/' $(RENDERDIR)/blfs-pdf.fo
@echo "Generating PDF file..."
$(Q)if [ ! -e $(BASEDIR) ]; then \
mkdir -p $(BASEDIR); \
fi;
- $(Q)fop /tmp/blfs-pdf.fo $(BASEDIR)/$(PDF_OUTPUT)
+ $(Q)fop $(RENDERDIR)/blfs-pdf.fo $(BASEDIR)/$(PDF_OUTPUT)
nochunks: validxml profile-html
@echo "Generating non chunked XHTML file..."
$(Q)xsltproc --nonet -stringparam rootid $(ROOT_ID) \
--output $(BASEDIR)/$(NOCHUNKS_OUTPUT) \
- stylesheets/lfs-nochunks.xsl /tmp/blfs-html.xml
+ stylesheets/blfs-nochunks.xsl $(RENDERDIR)/blfs-html.xml
@echo "Running Tidy..."
$(Q)tidy -config tidy.conf $(BASEDIR)/$(NOCHUNKS_OUTPUT) || true
@@ -74,36 +83,36 @@ nochunks: validxml profile-html
$(Q)sed -i -e "[EMAIL PROTECTED]/[EMAIL PROTECTED]/[EMAIL PROTECTED]" \
$(BASEDIR)/$(NOCHUNKS_OUTPUT)
-validxml:
+validxml: createdir
@echo "Validating the book..."
$(Q)xmllint --nonet --noent --xinclude --postvalid \
- -o /tmp/blfs-full.xml index.xml
+ -o $(RENDERDIR)/blfs-full.xml index.xml
-profile-html: validxml
+profile-html: createdir validxml
@echo "Generating profiled XML for XHTML..."
$(Q)xsltproc --nonet --stringparam profile.condition html \
- --output /tmp/blfs-html.xml stylesheets/lfs-xsl/profile.xsl \
- /tmp/blfs-full.xml
+ --output $(RENDERDIR)/blfs-html.xml stylesheets/lfs-xsl/profile.xsl \
+ $(RENDERDIR)/blfs-full.xml
-blfs-patch-list: validxml
+blfs-patch-list: createdir validxml
@echo "Generating blfs-patch-list..."
- $(Q)xsltproc --nonet --output /tmp/blfs-patch-list \
- stylesheets/patcheslist.xsl /tmp/blfs-full.xml
- $(Q)sed -e "s|^.*/||" /tmp/blfs-patch-list > /tmp/blfs-patches
- $(Q)sort /tmp/blfs-patches > blfs-patch-list
+ $(Q)xsltproc --nonet --output $(RENDERDIR)/blfs-patch-list \
+ stylesheets/patcheslist.xsl $(RENDERDIR)/blfs-full.xml
+ $(Q)sed -e "s|^.*/||" $(RENDERDIR)/blfs-patch-list >
$(RENDERDIR)/blfs-patches
+ $(Q)sort $(RENDERDIR)/blfs-patches > blfs-patch-list
wget-list: validxml
@echo "Generating wget list..."
$(Q)mkdir -p $(BASEDIR)
$(Q)xsltproc --nonet --output $(BASEDIR)/wget-list \
- stylesheets/wget-list.xsl /tmp/blfs-full.xml
+ stylesheets/wget-list.xsl $(RENDERDIR)/blfs-full.xml
test-links: validxml
@echo "Generating test-links file..."
$(Q)mkdir -p $(BASEDIR)
$(Q)xsltproc --nonet --stringparam list_mode full \
--output $(BASEDIR)/test-links stylesheets/wget-list.xsl \
- /tmp/blfs-full.xml
+ $(RENDERDIR)/blfs-full.xml
@echo "Checking URLs, first pass..."
$(Q)rm -f $(BASEDIR)/{good,bad,true_bad}_urls
@@ -122,10 +131,10 @@ test-links: validxml
fi; \
done
-dump-commands: validxml
+dump-commands: validxml clean
@echo "Dumping book commands..."
$(Q)xsltproc --output $(DUMPDIR)/ \
- stylesheets/dump-commands.xsl /tmp/blfs-full.xml
+ stylesheets/dump-commands.xsl $(RENDERDIR)/blfs-full.xml
validate:
@echo "Validating the book..."
--
http://linuxfromscratch.org/mailman/listinfo/blfs-dev
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page