[Mesa-dev] [PATCH] Mesa: Fix a race in the build

Dan Nicholson dbn.lists at gmail.com
Tue Jun 12 15:47:22 PDT 2012


On 6/12/12, Stéphane Marchesin <marcheu at chromium.org> wrote:
> From: Mike Frysinger <vapier at chromium.org>
>
> The intent of the message above it is right (we need to build those
> dependencies in that order) but the implementation is wrong, as it
> can be executed in any order. To enforce the order, invoke make
> multiple times.
> ---
>  src/mesa/Makefile |    8 ++++++--
>  1 files changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/src/mesa/Makefile b/src/mesa/Makefile
> index b0b461f..c436890 100644
> --- a/src/mesa/Makefile
> +++ b/src/mesa/Makefile
> @@ -33,8 +33,12 @@ MESA_CXXFLAGS := $(LLVM_CFLAGS) $(CXXFLAGS)
>  	$(CC) -c -o $@ $< $(MESA_CPPFLAGS) $(MESA_CFLAGS)
>
>  # Default: build dependencies, then asm_subdirs, GLSL built-in lib,
> -# then convenience libs (.a) and finally the device drivers:
> -default: $(DEPENDS) asm_subdirs $(MESA_LIBS) driver_subdirs
> +# then convenience libs (.a) and finally the device drivers.
> +# To ensure ordering, we have to invoke make each time:
> +default: $(DEPENDS)
> +	$(MAKE) asm_subdirs
> +	$(MAKE) $(MESA_LIBS)
> +	$(MAKE) driver_subdirs
>
>  .PHONY: main/git_sha1.h.tmp
>  main/git_sha1.h.tmp:

The alternative that's more correct is to encode the dependencies in
the right locations. I.e., make $(DEPENDS) a prereq for asm_subdirs,
asm_subdirs as prereq for $(MESA_LIBS), etc. That enforces the order
in the correct place and allows you to do something like "make
driver_dirs" and have it work correctly. Some of that is already
there, and it would be useful to know which part is racing. I suppose
if no one is going to do that work, though...

Reviewed-by: Dan Nicholson <dbn.lists at gmail.com>


More information about the mesa-dev mailing list