[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] libxl, buildmakevars2file: Do not relink libxl each time



# HG changeset patch
# User Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
# Date 1285081718 -3600
# Node ID 77a3da957017c799a553fd21ae3cf040abdac255
# Parent  588339604ec7e0b5274a2a4033629ccd5e0df2b3
libxl, buildmakevars2file: Do not relink libxl each time

Make Config.mk's definition of buildmakevars2file and
tools/libxl/Makefile's rule for _libxl_paths.h generate their files to
temporary files and only rename them into place if the intended file
has changed.  This gets rid of unnecessarily compilation and link
steps.

Add *.tmp to .hgignore.

Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Acked-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
 .hgignore            |    1 +
 Config.mk            |   21 +++++++++++----------
 tools/libxl/Makefile |    6 +++---
 3 files changed, 15 insertions(+), 13 deletions(-)

diff -r 588339604ec7 -r 77a3da957017 .hgignore
--- a/.hgignore Tue Sep 21 15:59:01 2010 +0100
+++ b/.hgignore Tue Sep 21 16:08:38 2010 +0100
@@ -11,6 +11,7 @@
 .*\.tar\.bz2$
 .*\.tar\.gz$
 .*~$
+.*\.tmp$
 .*\.flc$
 .*\.orig$
 .*\.rej$
diff -r 588339604ec7 -r 77a3da957017 Config.mk
--- a/Config.mk Tue Sep 21 15:59:01 2010 +0100
+++ b/Config.mk Tue Sep 21 16:08:38 2010 +0100
@@ -120,16 +120,17 @@ define buildmakevars2file-closure
 define buildmakevars2file-closure
     .PHONY: genpath
     genpath:
-       rm -f $(1);                                                    \
-       echo "SBINDIR=\"$(SBINDIR)\"" >> $(1);                         \
-       echo "BINDIR=\"$(BINDIR)\"" >> $(1);                           \
-       echo "LIBEXEC=\"$(LIBEXEC)\"" >> $(1);                         \
-       echo "LIBDIR=\"$(LIBDIR)\"" >> $(1);                           \
-       echo "SHAREDIR=\"$(SHAREDIR)\"" >> $(1);                       \
-       echo "PRIVATE_BINDIR=\"$(PRIVATE_BINDIR)\"" >> $(1);           \
-       echo "XENFIRMWAREDIR=\"$(XENFIRMWAREDIR)\"" >> $(1);           \
-       echo "XEN_CONFIG_DIR=\"$(XEN_CONFIG_DIR)\"" >> $(1);           \
-       echo "XEN_SCRIPT_DIR=\"$(XEN_SCRIPT_DIR)\"" >> $(1)
+       rm -f $(1).tmp;                                                    \
+       echo "SBINDIR=\"$(SBINDIR)\"" >> $(1).tmp;                         \
+       echo "BINDIR=\"$(BINDIR)\"" >> $(1).tmp;                           \
+       echo "LIBEXEC=\"$(LIBEXEC)\"" >> $(1).tmp;                         \
+       echo "LIBDIR=\"$(LIBDIR)\"" >> $(1).tmp;                           \
+       echo "SHAREDIR=\"$(SHAREDIR)\"" >> $(1).tmp;                       \
+       echo "PRIVATE_BINDIR=\"$(PRIVATE_BINDIR)\"" >> $(1).tmp;           \
+       echo "XENFIRMWAREDIR=\"$(XENFIRMWAREDIR)\"" >> $(1).tmp;           \
+       echo "XEN_CONFIG_DIR=\"$(XEN_CONFIG_DIR)\"" >> $(1).tmp;           \
+       echo "XEN_SCRIPT_DIR=\"$(XEN_SCRIPT_DIR)\"" >> $(1).tmp;           \
+       if ! cmp $(1).tmp $(1); then mv -f $(1).tmp $(1); fi
 endef
 
 ifeq ($(debug),y)
diff -r 588339604ec7 -r 77a3da957017 tools/libxl/Makefile
--- a/tools/libxl/Makefile      Tue Sep 21 15:59:01 2010 +0100
+++ b/tools/libxl/Makefile      Tue Sep 21 16:08:38 2010 +0100
@@ -52,12 +52,12 @@ all: $(CLIENTS) libxenlight.so libxenlig
        @rm -f $*.[ch]
        $(FLEX) --header-file=$*.h --outfile=$*.c $<
 
-genpath-target = $(call buildmakevars2file,_libxl_paths.h)
+genpath-target = $(call buildmakevars2file,_libxl_paths.h.tmp)
 $(eval $(genpath-target))
 
 _libxl_paths.h: genpath
-       sed -e "s/\([^=]*\)=\(.*\)/#define \1 \2/g" $@ >_$@
-       mv _$@ $@
+       sed -e "s/\([^=]*\)=\(.*\)/#define \1 \2/g" $@.tmp >$@.2.tmp
+       if ! cmp $@.2.tmp $@; then mv -f $@.2.tmp $@; fi
 
 libxl_paths.c: _libxl_paths.h
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.