debuggers.hg

changeset 21049:8f98581c2dd1

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>
author Keir Fraser <keir.fraser@citrix.com>
date Fri Mar 05 14:40:19 2010 +0000 (2010-03-05)
parents 87ed57b6e4cd
children b82dd03944e0
files stubdom/Makefile tools/flask/policy/Makefile tools/xenstat/libxenstat/Makefile
line diff
     1.1 --- a/stubdom/Makefile	Fri Mar 05 14:39:25 2010 +0000
     1.2 +++ b/stubdom/Makefile	Fri Mar 05 14:40:19 2010 +0000
     1.3 @@ -265,9 +265,11 @@ TARGETS_MINIOS=$(addprefix mini-os-$(XEN
     1.4  
     1.5  .PHONY: libxc
     1.6  libxc: libxc-$(XEN_TARGET_ARCH)/libxenctrl.a libxc-$(XEN_TARGET_ARCH)/libxenguest.a
     1.7 -libxc-$(XEN_TARGET_ARCH)/libxenctrl.a libxc-$(XEN_TARGET_ARCH)/libxenguest.a:: cross-zlib
     1.8 +libxc-$(XEN_TARGET_ARCH)/libxenctrl.a: cross-zlib
     1.9  	CPPFLAGS="$(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" $(MAKE) -C libxc-$(XEN_TARGET_ARCH)
    1.10  
    1.11 + libxc-$(XEN_TARGET_ARCH)/libxenguest.a: libxc-$(XEN_TARGET_ARCH)/libxenctrl.a
    1.12 +
    1.13  #######
    1.14  # ioemu
    1.15  #######
     2.1 --- a/tools/flask/policy/Makefile	Fri Mar 05 14:39:25 2010 +0000
     2.2 +++ b/tools/flask/policy/Makefile	Fri Mar 05 14:40:19 2010 +0000
     2.3 @@ -166,7 +166,8 @@ load: tmp/load
     2.4  #
     2.5  # Load the binary policy
     2.6  #
     2.7 -reload tmp/load: $(LOADPATH) $(FCPATH)
     2.8 +tmp/load: reload
     2.9 +reload: $(LOADPATH) $(FCPATH)
    2.10  	@echo "Loading $(NAME) $(LOADPATH)"
    2.11  	$(QUIET) $(LOADPOLICY) $(LOADPATH)
    2.12  	@touch tmp/load
    2.13 @@ -205,7 +206,8 @@ tmp/post_te_files.conf: $(POST_TE_FILES)
    2.14  # extract attributes and put them first. extract post te stuff
    2.15  # like genfscon and put last.  portcon, nodecon, and netifcon
    2.16  # is delayed since they are generated by m4
    2.17 -tmp/all_attrs_types.conf tmp/only_te_rules.conf tmp/all_post.conf: tmp/all_te_files.conf tmp/post_te_files.conf
    2.18 +tmp/all_attrs_types.conf tmp/all_post.conf: tmp/only_te_rules.conf
    2.19 +tmp/only_te_rules.conf: tmp/all_te_files.conf tmp/post_te_files.conf
    2.20  	$(QUIET) grep ^attribute tmp/all_te_files.conf > tmp/all_attrs_types.conf || true
    2.21  	$(QUIET) grep '^type ' tmp/all_te_files.conf >> tmp/all_attrs_types.conf
    2.22  	$(QUIET) cat tmp/post_te_files.conf > tmp/all_post.conf
     3.1 --- a/tools/xenstat/libxenstat/Makefile	Fri Mar 05 14:39:25 2010 +0000
     3.2 +++ b/tools/xenstat/libxenstat/Makefile	Fri Mar 05 14:40:19 2010 +0000
     3.3 @@ -107,7 +107,8 @@ SWIG_FLAGS=-module xenstat -Isrc
     3.4  # Python bindings
     3.5  PYTHON_VERSION=2.3
     3.6  PYTHON_FLAGS=-I/usr/include/python$(PYTHON_VERSION) -lpython$(PYTHON_VERSION)
     3.7 -$(PYSRC) $(PYMOD): bindings/swig/xenstat.i
     3.8 +$(PYMOD): $(PYSRC)
     3.9 +$(PYSRC): bindings/swig/xenstat.i
    3.10  	swig -python $(SWIG_FLAGS) -outdir $(@D) -o $(PYSRC) $<
    3.11  
    3.12  $(PYLIB): $(PYSRC)
    3.13 @@ -128,7 +129,8 @@ endif
    3.14  
    3.15  # Perl bindings
    3.16  PERL_FLAGS=`perl -MConfig -e 'print "$$Config{ccflags} -I$$Config{archlib}/CORE";'`
    3.17 -$(PERLSRC) $(PERLMOD): bindings/swig/xenstat.i
    3.18 +$(PERLMOD): $(PERLSRC)
    3.19 +$(PERLSRC): bindings/swig/xenstat.i
    3.20  	swig -perl $(SWIG_FLAGS) -outdir $(@D) -o $(PERLSRC) $<
    3.21  
    3.22  $(PERLLIB): $(PERLSRC)