From: Johannes Stezenbach <js@sig21.net>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] [PATCH] Use `ln -sf` rather than `rm -f && ln -s`
Date: Tue, 29 Jan 2008 00:11:25 +0100 [thread overview]
Message-ID: <20080128231125.GA27063@sig21.net> (raw)
In-Reply-To: <200801280638.59012.vapier@gentoo.org>
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 <js@sig21.net>
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
next prev parent reply other threads:[~2008-01-28 23:11 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-28 11:37 [U-Boot-Users] [PATCH] Use `ln -sf` rather than `rm -f && ln -s` Mike Frysinger
2008-01-28 11:38 ` Mike Frysinger
2008-01-28 20:56 ` Wolfgang Denk
2008-01-28 21:16 ` Mike Frysinger
2008-01-28 21:41 ` J. William Campbell
2008-01-28 23:11 ` Johannes Stezenbach [this message]
2008-01-29 0:27 ` Mike Frysinger
2008-02-14 0:18 ` Wolfgang Denk
2008-01-28 20:53 ` Wolfgang Denk
2008-01-28 20:57 ` Mike Frysinger
2008-04-14 19:50 ` Wolfgang Denk
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080128231125.GA27063@sig21.net \
--to=js@sig21.net \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox