On 6/13/12, Mike Frysinger <[email protected]> wrote: > On Wed, Jun 13, 2012 at 8:13 AM, Dan Nicholson <[email protected]> wrote: > >> On Tue, Jun 12, 2012 at 3:52 PM, Mike Frysinger <[email protected]> >> wrote: >> > On Tue, Jun 12, 2012 at 6:47 PM, Dan Nicholson <[email protected]> >> wrote: >> >> >> >> On 6/12/12, Stéphane Marchesin <[email protected]> wrote: >> >> > From: Mike Frysinger <[email protected]> >> >> > >> >> > 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... >> > >> > >> > 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. >> >> Right, PHONY asm_subdirs does break that. Looking back into this now, >> I'm surprised it's broken. This did work for a long time. The reason >> is because MESA_LIBS will not be built until asm_subdirs is completed. >> This is because MESA_OBJECTS and MESA_GALLIUM_OBJECTS contain >> MESA_ASM_FILES, which are what's produced by descending through >> asm_subdirs. So, make will have to wait for asm_subdirs to complete >> before it can try to link libmesa.a or libgallium.a. I suspect what's >> broken this now is prefixing all the sources in sources.mak with >> $(SRCDIR). At least, I'd really like to see an actual error. >> > > iirc, the debug+fix session happened on irc, so i didn't post any of the > errors, and the log files we were reviewing no longer exist on the bots. > > the error is related to not building in subdirs anymore. look at > src/mesa/{x86,x86-64}/Makefile -- you'll see that there's a matypes.h > header generated, and the objects declare dependencies on that. but that > isn'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.
Hmm, I recall that had worked at one point, but looking again I don't see how. I think your patch is correct and essentially does the same thing as automake in serializing the directory recursion but without all the generic syntax. Essentially this is like "SUBDIRS = x86 x86-64 . drivers" on x86_64 with the extra nit that DEPENDS happens at the beginning and not at the same time as the . directory. Reviewed-by: Dan Nicholson <[email protected]> _______________________________________________ mesa-dev mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/mesa-dev
