* [PATCH -mm] actually delete the as-instr/ld-option tmp file
@ 2006-12-04 11:35 Horst Schirmeier
0 siblings, 0 replies; only message in thread
From: Horst Schirmeier @ 2006-12-04 11:35 UTC (permalink / raw)
To: Andrew Morton, Andi Kleen, Jan Beulich, Sam Ravnborg, jpdenheijer,
linux-kernel
[-- Attachment #1: Type: text/plain, Size: 2114 bytes --]
I noticed another problem in the
kbuild-dont-put-temp-files-in-the-source-tree.patch: A "normal" make
variable is being expanded recursively on each use, therefore multiple
uses of $(ASTMP) yield different temporary files. So $(AS) -o $(ASTMP)
writes to a file other than the one rm -f $(ASTMP) deletes, leaving
behind the first file in /tmp.
Using "simply expanded variables" (by assigning the mktemp output with
:= instead of =) can be problematic, as parallel make processes would
all write to and delete the very same tmp file, so I chose to fix this
by storing the $(ASTMP) output in a shell variable and reusing it.
Signed-off-by: Horst Schirmeier <horst@schirmeier.com>
---
Kbuild.include | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
--- linux/scripts/Kbuild.include.current-mm 2006-12-04 11:31:55.000000000 +0100
+++ linux/scripts/Kbuild.include 2006-12-04 11:40:10.000000000 +0100
@@ -67,9 +67,10 @@ as-option = $(shell if $(CC) $(CFLAGS) $
# Usage: cflags-y += $(call as-instr, instr, option1, option2)
ASTMP = $(shell mktemp $${TMPDIR:-/tmp}/asXXXXXX)
-as-instr = $(shell if echo -e "$(1)" | $(AS) >/dev/null 2>&1 -W -Z -o $(ASTMP) ; \
+as-instr = $(shell ASTMP=$(ASTMP); \
+ if echo -e "$(1)" | $(AS) >/dev/null 2>&1 -W -Z -o $$ASTMP ; \
then echo "$(2)"; else echo "$(3)"; fi; \
- rm -f $(ASTMP))
+ rm -f $$ASTMP)
# cc-option
# Usage: cflags-y += $(call cc-option, -march=winchip-c6, -march=i586)
@@ -99,10 +100,10 @@ cc-ifversion = $(shell if [ $(call cc-ve
# ld-option
# Usage: ldflags += $(call ld-option, -Wl$(comma)--hash-style=both)
LDTMP = $(shell mktemp $${TMPDIR:-/tmp}/ldXXXXXX)
-ld-option = $(shell if $(CC) $(1) \
- -nostdlib -o $(LDTMP) -xc /dev/null \
+ld-option = $(shell LDTMP=$(LDTMP); \
+ if $(CC) $(1) -nostdlib -o $$LDTMP -xc /dev/null \
> /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi; \
- rm -f $(LDTMP))
+ rm -f $$LDTMP)
###
# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.build obj=
--
PGP-Key 0xD40E0E7A
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2006-12-04 11:35 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-12-04 11:35 [PATCH -mm] actually delete the as-instr/ld-option tmp file Horst Schirmeier
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.