On Mon, Jan 28, 2008 at 06:38:58AM -0500, Mike Frysinger wrote:
> The -f option to `ln` should give the same behavior as the -f option to the
> `rm` command.  It is better to do this in one shot so as to avoid race
> conditions when building in parallel.  I build on a quad G5 and without this
> change, it isn't uncommon for the build to fail when using -j8 due to this
> small window where the files don't actually exist.

Since there is a clear dependency of environment.o on environment.c
there is no way for make to run the rm/ln and $(CC) commands
in parallel, so there should be no race condition.
For illustrative purposes: you should be able to put a sleep
between the rm and the ln -s, and it should still build.

It seems the real problem is one level above, the commands
were run twice in parallel, once for "depend" and once
for the SUBDIRS "all". Please test the patch below.

The

  $(obj)u-boot:         depend $(SUBDIRS) $(OBJS) $(LIBS) $(LDSCRIPT)

line tells make it can run commands to update each dependency
in parallel, unless there are further dependencies which restrict this.


Thanks,
Johannes

---
Add dependencies to avoid race conditions with parallel make.

Signed-off-by: Johannes Stezenbach <[EMAIL PROTECTED]>

diff --git a/Makefile b/Makefile
index 0f6cc59..464db34 100644
--- a/Makefile
+++ b/Makefile
@@ -317,13 +317,13 @@ $(obj)u-boot:             depend $(SUBDIRS) $(OBJS) 
$(LIBS) $(LDSCRIPT)
                        --start-group $(__LIBS) --end-group $(PLATFORM_LIBS) \
                        -Map u-boot.map -o u-boot
 
-$(OBJS):       $(obj)include/autoconf.mk
+$(OBJS):       depend $(obj)include/autoconf.mk
                $(MAKE) -C cpu/$(CPU) $(if $(REMOTE_BUILD),$@,$(notdir $@))
 
-$(LIBS):       $(obj)include/autoconf.mk
+$(LIBS):       depend $(obj)include/autoconf.mk
                $(MAKE) -C $(dir $(subst $(obj),,$@))
 
-$(SUBDIRS):    $(obj)include/autoconf.mk
+$(SUBDIRS):    depend $(obj)include/autoconf.mk
                $(MAKE) -C $@ all
 
 $(NAND_SPL):   $(VERSION_FILE) $(obj)include/autoconf.mk

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
U-Boot-Users mailing list
U-Boot-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/u-boot-users

Reply via email to