]> xenbits.xensource.com Git - xen.git/commitdiff
Fix Makefile targets that generate several files at once
authorKeir Fraser <keir.fraser@citrix.com>
Fri, 5 Mar 2010 14:40:19 +0000 (14:40 +0000)
committerKeir Fraser <keir.fraser@citrix.com>
Fri, 5 Mar 2010 14:40:19 +0000 (14:40 +0000)
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>
stubdom/Makefile
tools/flask/policy/Makefile
tools/xenstat/libxenstat/Makefile

index 15048f08a18023f91ebde4f549600cc29d89e7f5..43e8e9217bd5738e9e0376922883522725fd0407 100644 (file)
@@ -265,9 +265,11 @@ $(TARGETS_MINIOS): mini-os-%:
 
 .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
 #######
index 4c0d428b571a35229b47c1135951506f64b5ac1f..e39f0761ea2b07cefef7c66e4b13d80b97bc82eb 100644 (file)
@@ -166,7 +166,8 @@ $(LOADPATH): policy.conf
 #
 # 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 @@ tmp/post_te_files.conf: $(POST_TE_FILES)
 # 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
index b40992959fe8c315c4692f2c926b353aafcf479f..44313c77fee24e149d44e5fabab78b2a88243f48 100644 (file)
@@ -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)