How's this?
[[[
Improve the book Makefile so it updates when it should and doesn't when it
shouldn't. It was always updating book-html-chunk, and never updating the
embedded revision number.
* doc/book/Makefile
Re-check the output of "svnversion" every time, but only update version.xml
if the revision number has changed. (Previously version.xml was never
updated unless it had been deleted.)
Only rebuild book-html-chunk if it is older than its (main) source files.
(Previously it was re-built every time.)
The image files are now dependencies of most targets.
]]]
I'll commit it in a couple of days if there are no objections.
- Julian
Improve the book Makefile so it updates when it should and doesn't when it
shouldn't. It was always updating book-html-chunk, and never updating the
embedded revision number.
* doc/book/Makefile
Re-check the output of "svnversion" every time, but only update version.xml
if the revision number has changed. (Previously version.xml was never
updated unless it had been deleted.)
Only rebuild book-html-chunk if it is older than its (main) source files.
(Previously it was re-built every time.)
The image files are now dependencies of most targets.
Index: doc/book/Makefile
===================================================================
--- doc/book/Makefile (revision 7020)
+++ doc/book/Makefile (working copy)
@@ -10,12 +10,14 @@
BOOK_HTML_CHUNK_DIR = $(BOOK_DIR)/html-chunk
BOOK_DIR = ${BOOK_TOP}/book
BOOK_HTML_TARGET = $(BOOK_DIR)/book.html
+BOOK_HTML_CHUNK_TARGET = $(BOOK_HTML_CHUNK_DIR)/index.html # index.html is created last
BOOK_PDF_TARGET = $(BOOK_DIR)/book.pdf
BOOK_PS_TARGET = $(BOOK_DIR)/book.ps
BOOK_FO_TARGET = $(BOOK_DIR)/book.fo
BOOK_XML_SOURCE = $(BOOK_DIR)/book.xml
BOOK_VERSION_SOURCE = $(BOOK_DIR)/version.xml
BOOK_ALL_SOURCE = $(BOOK_DIR)/*.xml
+BOOK_IMAGES = $(BOOK_DIR)/images/*.png
BOOK_INSTALL_DIR = $(INSTALL_DIR)/book
MDOCS_DIR = ${BOOK_TOP}/misc-docs
@@ -63,12 +65,19 @@
clean: book-clean misc-docs-clean
-$(BOOK_VERSION_SOURCE):
- @if $(SVNVERSION) .; then \
- echo '<!ENTITY svn.version "Draft Revision '`$(SVNVERSION) .`'">' > $(BOOK_VERSION_SOURCE); \
+$(BOOK_VERSION_SOURCE): book-version
+
+book-version:
+ @if $(SVNVERSION) . > /dev/null; then \
+ echo '<!ENTITY svn.version "Draft Revision '`$(SVNVERSION) .`'">' > $(BOOK_VERSION_SOURCE).tmp; \
else \
- echo '<!ENTITY svn.version "Draft">' > $(BOOK_VERSION_SOURCE); \
+ echo '<!ENTITY svn.version "Draft">' > $(BOOK_VERSION_SOURCE).tmp; \
fi
+ @if cmp -s $(BOOK_VERSION_SOURCE) $(BOOK_VERSION_SOURCE).tmp; then \
+ rm $(BOOK_VERSION_SOURCE).tmp; \
+ else \
+ mv $(BOOK_VERSION_SOURCE).tmp $(BOOK_VERSION_SOURCE); \
+ fi
book-html: $(BOOK_HTML_TARGET)
@@ -76,25 +85,28 @@
$(XSLTPROC) $(BOOK_HTML_XSLTPROC_OPTS) \
--output $(BOOK_HTML_TARGET) $(XSL_HTML) $(BOOK_XML_SOURCE)
+book-html-chunk: $(BOOK_HTML_CHUNK_TARGET)
+
## This trailing slash is essential that xsltproc will output pages to the dir
-book-html-chunk: $(BOOK_ALL_SOURCE) $(BOOK_VERSION_SOURCE)
+$(BOOK_HTML_CHUNK_TARGET): $(BOOK_ALL_SOURCE) $(BOOK_VERSION_SOURCE) \
+ $(BOOK_DIR)/styles.css $(BOOK_IMAGES)
mkdir -p $(BOOK_HTML_CHUNK_DIR)
$(XSLTPROC) $(BOOK_HTML_XSLTPROC_OPTS) \
--output $(BOOK_HTML_CHUNK_DIR)/ \
$(XSL_HTML_CHUNK) $(BOOK_XML_SOURCE)
cp $(BOOK_DIR)/styles.css $(BOOK_HTML_CHUNK_DIR)
- cp $(BOOK_DIR)/images/*.png $(BOOK_HTML_CHUNK_DIR)
+ cp $(BOOK_IMAGES) $(BOOK_HTML_CHUNK_DIR)
book-pdf: $(BOOK_PDF_TARGET)
book-ps: $(BOOK_PS_TARGET)
-$(BOOK_PDF_TARGET): $(BOOK_ALL_SOURCE) $(BOOK_VERSION_SOURCE)
+$(BOOK_PDF_TARGET): $(BOOK_ALL_SOURCE) $(BOOK_VERSION_SOURCE) $(BOOK_IMAGES)
$(XSLTPROC) $(BOOK_PDF_XSLTPROC_OPTS) \
--output $(BOOK_FO_TARGET) $(XSL_FO) $(BOOK_XML_SOURCE)
$(RUN_FOP) $(BOOK_TOP) -fo $(BOOK_FO_TARGET) -pdf $(BOOK_PDF_TARGET)
-$(BOOK_PS_TARGET): $(BOOK_ALL_SOURCE) $(BOOK_VERSION_SOURCE)
+$(BOOK_PS_TARGET): $(BOOK_ALL_SOURCE) $(BOOK_VERSION_SOURCE) $(BOOK_IMAGES)
$(XSLTPROC) $(BOOK_PS_XSLTPROC_OPTS) \
--output $(BOOK_FO_TARGET) $(XSL_FO) $(BOOK_XML_SOURCE)
$(RUN_FOP) $(BOOK_TOP) -fo $(BOOK_FO_TARGET) -ps $(BOOK_PS_TARGET)
@@ -106,14 +118,13 @@
$(INSTALL) -d $(BOOK_INSTALL_DIR)/images
$(INSTALL) $(BOOK_HTML_TARGET) $(BOOK_INSTALL_DIR)
$(INSTALL) $(BOOK_DIR)/styles.css $(BOOK_INSTALL_DIR)
- $(INSTALL) $(BOOK_DIR)/images/*.png $(BOOK_INSTALL_DIR)/images
+ $(INSTALL) $(BOOK_IMAGES) $(BOOK_INSTALL_DIR)/images
-## index.html is created last
-install-book-html-chunk: $(BOOK_HTML_CHUNK_DIR)/index.html
+install-book-html-chunk: $(BOOK_HTML_CHUNK_TARGET)
$(INSTALL) -d $(BOOK_INSTALL_DIR)/images
$(INSTALL) $(BOOK_HTML_CHUNK_DIR)/*.html $(BOOK_INSTALL_DIR)
$(INSTALL) $(BOOK_DIR)/styles.css $(BOOK_INSTALL_DIR)
- $(INSTALL) $(BOOK_DIR)/images/*.png $(BOOK_INSTALL_DIR)/images
+ $(INSTALL) $(BOOK_IMAGES) $(BOOK_INSTALL_DIR)/images
install-book-pdf: $(BOOK_PDF_TARGET) $(BOOK_INSTALL_DIR)
$(INSTALL) $(BOOK_PDF_TARGET) $(BOOK_INSTALL_DIR)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Sep 10 01:41:42 2003