Ian Jackson
2010-Sep-20 16:06 UTC
[Xen-devel] [PATCH] 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. Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> diff -r 81c40c5db26e Config.mk --- a/Config.mk Mon Sep 20 16:57:08 2010 +0100 +++ b/Config.mk Mon Sep 20 17:04:34 2010 +0100 @@ -104,16 +104,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 81c40c5db26e tools/libxl/Makefile --- a/tools/libxl/Makefile Mon Sep 20 16:57:08 2010 +0100 +++ b/tools/libxl/Makefile Mon Sep 20 17:04:34 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-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Ian Jackson
2010-Sep-20 16:56 UTC
Re: [Xen-devel] [PATCH] libxl, buildmakevars2file: Do not relink libxl each time
Ian Jackson writes ("[Xen-devel] [PATCH] 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.Looks like *.tmp isn''t in the .hgignore! If the patch meets with approval I''ll add that too. Ian. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Keir Fraser
2010-Sep-20 17:41 UTC
Re: [Xen-devel] [PATCH] libxl, buildmakevars2file: Do not relink libxl each time
On 20/09/2010 17:56, "Ian Jackson" <Ian.Jackson@eu.citrix.com> wrote:> Ian Jackson writes ("[Xen-devel] [PATCH] 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. > > Looks like *.tmp isn''t in the .hgignore! If the patch meets with > approval I''ll add that too.Fine by me. Acked-by: Keir Fraser <keir.fraser@citrix.com> -- Keir _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel