WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] Makefile targets generating several files at once

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] Makefile targets generating several files at once
From: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
Date: Fri, 5 Mar 2010 12:10:21 +0000
Delivery-date: Fri, 05 Mar 2010 04:11:23 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
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@xxxxxxxxxxxxx>

diff -r b8d2a4134a68 stubdom/Makefile
--- a/stubdom/Makefile  Wed Mar 03 17:41:58 2010 +0000
+++ b/stubdom/Makefile  Fri Mar 05 11:53:37 2010 +0000
@@ -265,8 +265,10 @@
 
 .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 b8d2a4134a68 tools/flask/policy/Makefile
--- a/tools/flask/policy/Makefile       Wed Mar 03 17:41:58 2010 +0000
+++ b/tools/flask/policy/Makefile       Fri Mar 05 11:53:37 2010 +0000
@@ -166,7 +166,8 @@
 #
 # Load the binary policy
 #
-reload tmp/load: $(LOADPATH) $(FCPATH)
+tmp/load: reload
+reload: $(LOADPATH) $(FCPATH)
        @echo "Loading $(NAME) $(LOADPATH)"
        $(QUIET) $(LOADPOLICY) $(LOADPATH)
        @touch tmp/load
@@ -205,7 +206,8 @@
 # extract attributes and put them first. extract post te stuff
 # like genfscon and put last.  portcon, nodecon, and netifcon
 # is delayed since they are generated by m4
-tmp/all_attrs_types.conf tmp/only_te_rules.conf tmp/all_post.conf: 
tmp/all_te_files.conf tmp/post_te_files.conf
+tmp/all_attrs_types.conf tmp/all_post.conf: tmp/only_te_rules.conf
+tmp/only_te_rules.conf: tmp/all_te_files.conf tmp/post_te_files.conf
        $(QUIET) grep ^attribute tmp/all_te_files.conf > 
tmp/all_attrs_types.conf || true
        $(QUIET) grep '^type ' tmp/all_te_files.conf >> tmp/all_attrs_types.conf
        $(QUIET) cat tmp/post_te_files.conf > tmp/all_post.conf
diff -r b8d2a4134a68 tools/xenstat/libxenstat/Makefile
--- a/tools/xenstat/libxenstat/Makefile Wed Mar 03 17:41:58 2010 +0000
+++ b/tools/xenstat/libxenstat/Makefile Fri Mar 05 11:53:37 2010 +0000
@@ -107,7 +107,8 @@
 # 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 @@
 
 # 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-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] Makefile targets generating several files at once, Ian Jackson <=