<div class="gmail_quote">On Wed, Jun 13, 2012 at 8:13 AM, Dan Nicholson <span dir="ltr">&lt;<a href="mailto:dbn.lists@gmail.com" target="_blank">dbn.lists@gmail.com</a>&gt;</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 Tue, Jun 12, 2012 at 3:52 PM, Mike Frysinger &lt;<a href="mailto:vapier@chromium.org">vapier@chromium.org</a>&gt; wrote:<br>
&gt; On Tue, Jun 12, 2012 at 6:47 PM, Dan Nicholson &lt;<a href="mailto:dbn.lists@gmail.com">dbn.lists@gmail.com</a>&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt; On 6/12/12, Stéphane Marchesin &lt;<a href="mailto:marcheu@chromium.org">marcheu@chromium.org</a>&gt; wrote:<br>
&gt;&gt; &gt; From: Mike Frysinger &lt;<a href="mailto:vapier@chromium.org">vapier@chromium.org</a>&gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; The intent of the message above it is right (we need to build those<br>
&gt;&gt; &gt; dependencies in that order) but the implementation is wrong, as it<br>
&gt;&gt; &gt; can be executed in any order. To enforce the order, invoke make<br>
&gt;&gt; &gt; multiple times.<br>
&gt;&gt; &gt; ---<br>
&gt;&gt; &gt;  src/mesa/Makefile |    8 ++++++--<br>
&gt;&gt; &gt;  1 files changed, 6 insertions(+), 2 deletions(-)<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; diff --git a/src/mesa/Makefile b/src/mesa/Makefile<br>
&gt;&gt; &gt; index b0b461f..c436890 100644<br>
&gt;&gt; &gt; --- a/src/mesa/Makefile<br>
&gt;&gt; &gt; +++ b/src/mesa/Makefile<br>
&gt;&gt; &gt; @@ -33,8 +33,12 @@ MESA_CXXFLAGS := $(LLVM_CFLAGS) $(CXXFLAGS)<br>
&gt;&gt; &gt;       $(CC) -c -o $@ $&lt; $(MESA_CPPFLAGS) $(MESA_CFLAGS)<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;  # Default: build dependencies, then asm_subdirs, GLSL built-in lib,<br>
&gt;&gt; &gt; -# then convenience libs (.a) and finally the device drivers:<br>
&gt;&gt; &gt; -default: $(DEPENDS) asm_subdirs $(MESA_LIBS) driver_subdirs<br>
&gt;&gt; &gt; +# then convenience libs (.a) and finally the device drivers.<br>
&gt;&gt; &gt; +# To ensure ordering, we have to invoke make each time:<br>
&gt;&gt; &gt; +default: $(DEPENDS)<br>
&gt;&gt; &gt; +     $(MAKE) asm_subdirs<br>
&gt;&gt; &gt; +     $(MAKE) $(MESA_LIBS)<br>
&gt;&gt; &gt; +     $(MAKE) driver_subdirs<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;  .PHONY: main/git_sha1.h.tmp<br>
&gt;&gt; &gt;  main/git_sha1.h.tmp:<br>
&gt;&gt;<br>
&gt;&gt; The alternative that&#39;s more correct is to encode the dependencies in<br>
&gt;&gt; the right locations. I.e., make $(DEPENDS) a prereq for asm_subdirs,<br>
&gt;&gt; asm_subdirs as prereq for $(MESA_LIBS), etc. That enforces the order<br>
&gt;&gt; in the correct place and allows you to do something like &quot;make<br>
&gt;&gt; driver_dirs&quot; and have it work correctly. Some of that is already<br>
&gt;&gt; there, and it would be useful to know which part is racing. I suppose<br>
&gt;&gt; if no one is going to do that work, though...<br>
&gt;<br>
&gt;<br>
&gt; the trouble is that w/out GNU make, you can&#39;t declare a dependency as<br>
&gt; order-only.  so by having $(MESA_LIBS) depend on asm_subdirs (which is a<br>
&gt; PHONY target), things end up getting regenerated all the time.<br>
<br>
</div></div>Right, PHONY asm_subdirs does break that. Looking back into this now,<br>
I&#39;m surprised it&#39;s broken. This did work for a long time. The reason<br>
is because MESA_LIBS will not be built until asm_subdirs is completed.<br>
This is because MESA_OBJECTS and MESA_GALLIUM_OBJECTS contain<br>
MESA_ASM_FILES, which are what&#39;s produced by descending through<br>
asm_subdirs. So, make will have to wait for asm_subdirs to complete<br>
before it can try to link libmesa.a or libgallium.a. I suspect what&#39;s<br>
broken this now is prefixing all the sources in sources.mak with<br>
$(SRCDIR). At least, I&#39;d really like to see an actual error.<br></blockquote><div><br></div><div>iirc, the debug+fix session happened on irc, so i didn&#39;t post any of the errors, and the log files we were reviewing no longer exist on the bots.</div>

<div><br></div><div>the error is related to not building in subdirs anymore.  look at src/mesa/{x86,x86-64}/Makefile -- you&#39;ll see that there&#39;s a matypes.h header generated, and the objects declare dependencies on that.  but that isn&#39;t bubbled up, so if you build asm_subdirs and $(MESA_LIBS) in parallel, the objects that need matypes.h are built before matypes.h is generated.</div>

<div>-mike</div></div>