<div class="gmail_quote">On Tue, Jun 12, 2012 at 6:47 PM, Dan Nicholson <span dir="ltr"><<a href="mailto:dbn.lists@gmail.com" target="_blank">dbn.lists@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5">On 6/12/12, Stéphane Marchesin <<a href="mailto:marcheu@chromium.org">marcheu@chromium.org</a>> wrote:<br>
> From: Mike Frysinger <<a href="mailto:vapier@chromium.org">vapier@chromium.org</a>><br>
><br>
> The intent of the message above it is right (we need to build those<br>
> dependencies in that order) but the implementation is wrong, as it<br>
> can be executed in any order. To enforce the order, invoke make<br>
> multiple times.<br>
> ---<br>
> src/mesa/Makefile | 8 ++++++--<br>
> 1 files changed, 6 insertions(+), 2 deletions(-)<br>
><br>
> diff --git a/src/mesa/Makefile b/src/mesa/Makefile<br>
> index b0b461f..c436890 100644<br>
> --- a/src/mesa/Makefile<br>
> +++ b/src/mesa/Makefile<br>
> @@ -33,8 +33,12 @@ MESA_CXXFLAGS := $(LLVM_CFLAGS) $(CXXFLAGS)<br>
> $(CC) -c -o $@ $< $(MESA_CPPFLAGS) $(MESA_CFLAGS)<br>
><br>
> # Default: build dependencies, then asm_subdirs, GLSL built-in lib,<br>
> -# then convenience libs (.a) and finally the device drivers:<br>
> -default: $(DEPENDS) asm_subdirs $(MESA_LIBS) driver_subdirs<br>
> +# then convenience libs (.a) and finally the device drivers.<br>
> +# To ensure ordering, we have to invoke make each time:<br>
> +default: $(DEPENDS)<br>
> + $(MAKE) asm_subdirs<br>
> + $(MAKE) $(MESA_LIBS)<br>
> + $(MAKE) driver_subdirs<br>
><br>
> .PHONY: main/git_sha1.h.tmp<br>
> main/git_sha1.h.tmp:<br>
<br>
</div></div>The alternative that's more correct is to encode the dependencies in<br>
the right locations. I.e., make $(DEPENDS) a prereq for asm_subdirs,<br>
asm_subdirs as prereq for $(MESA_LIBS), etc. That enforces the order<br>
in the correct place and allows you to do something like "make<br>
driver_dirs" and have it work correctly. Some of that is already<br>
there, and it would be useful to know which part is racing. I suppose<br>
if no one is going to do that work, though...<br></blockquote><div><br></div><div>the trouble is that w/out GNU make, you can't declare a dependency as order-only. so by having $(MESA_LIBS) depend on asm_subdirs (which is a PHONY target), things end up getting regenerated all the time.</div>
<div><br></div><div>i picked this as the portable and least crappy solution. if you can make it work otherwise, SGTM :).</div><div>-mike</div></div>