Mailing List Archive

[xen-3.4-testing] Fix Makefile targets that generate several files at once
# HG changeset patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1268158194 0
# Node ID 0489c4f40f243deb206cc24ff19390cd770533d0
# Parent 351b79a183c91c061e92550019f0eee106f270f8
Fix Makefile targets that generate several files at once

In a few places in the tree the Makefiles have constructs like this:
one_file another_file:
$(COMMAND_WHICH_GENERATES_BOTH_AT_ONCE)
This is wrong, because make will run _two copies_ of the same command
at once. This generally causes races and hard-to-reproduce build
failures.

Notably, `make -j4' at the top level will build stubdom libxc twice
simultaneously!

In this patch we replace the occurrences of this construct with the
correct idiom:
one_file: another_file
another_file:
$(COMMAND_WHICH_GENERATES_BOTH_AT_ONCE)

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
xen-unstable changeset: 21003:8f98581c2dd1
xen-unstable date: Fri Mar 05 14:40:19 2010 +0000
---
stubdom/Makefile | 4 +++-
tools/xenstat/libxenstat/Makefile | 6 ++++--
2 files changed, 7 insertions(+), 3 deletions(-)

diff -r 351b79a183c9 -r 0489c4f40f24 stubdom/Makefile
--- a/stubdom/Makefile Tue Mar 09 18:08:57 2010 +0000
+++ b/stubdom/Makefile Tue Mar 09 18:09:54 2010 +0000
@@ -224,8 +224,10 @@ TARGETS_MINIOS=$(addprefix mini-os-$(XEN

.PHONY: libxc
libxc: libxc-$(XEN_TARGET_ARCH)/libxenctrl.a libxc-$(XEN_TARGET_ARCH)/libxenguest.a
-libxc-$(XEN_TARGET_ARCH)/libxenctrl.a libxc-$(XEN_TARGET_ARCH)/libxenguest.a:: cross-zlib
+libxc-$(XEN_TARGET_ARCH)/libxenctrl.a: cross-zlib
CPPFLAGS="$(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" $(MAKE) -C libxc-$(XEN_TARGET_ARCH)
+
+ libxc-$(XEN_TARGET_ARCH)/libxenguest.a: libxc-$(XEN_TARGET_ARCH)/libxenctrl.a

#######
# ioemu
diff -r 351b79a183c9 -r 0489c4f40f24 tools/xenstat/libxenstat/Makefile
--- a/tools/xenstat/libxenstat/Makefile Tue Mar 09 18:08:57 2010 +0000
+++ b/tools/xenstat/libxenstat/Makefile Tue Mar 09 18:09:54 2010 +0000
@@ -107,7 +107,8 @@ SWIG_FLAGS=-module xenstat -Isrc
# Python bindings
PYTHON_VERSION=2.3
PYTHON_FLAGS=-I/usr/include/python$(PYTHON_VERSION) -lpython$(PYTHON_VERSION)
-$(PYSRC) $(PYMOD): bindings/swig/xenstat.i
+$(PYMOD): $(PYSRC)
+$(PYSRC): bindings/swig/xenstat.i
swig -python $(SWIG_FLAGS) -outdir $(@D) -o $(PYSRC) $<

$(PYLIB): $(PYSRC)
@@ -128,7 +129,8 @@ endif

# Perl bindings
PERL_FLAGS=`perl -MConfig -e 'print "$$Config{ccflags} -I$$Config{archlib}/CORE";'`
-$(PERLSRC) $(PERLMOD): bindings/swig/xenstat.i
+$(PERLMOD): $(PERLSRC)
+$(PERLSRC): bindings/swig/xenstat.i
swig -perl $(SWIG_FLAGS) -outdir $(@D) -o $(PERLSRC) $<

$(PERLLIB): $(PERLSRC)

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