All of lore.kernel.org
 help / color / mirror / Atom feed
From: Horst Schirmeier <horst@schirmeier.com>
To: Andrew Morton <akpm@osdl.org>, Andi Kleen <ak@suse.de>,
	Jan Beulich <jbeulich@novell.com>,
	Sam Ravnborg <sam@ravnborg.org>,
	jpdenheijer@gmail.com, linux-kernel@vger.kernel.org
Subject: [PATCH -mm] actually delete the as-instr/ld-option tmp file
Date: Mon, 4 Dec 2006 12:35:49 +0100	[thread overview]
Message-ID: <20061204113549.GD31637@quickstop.soohrt.org> (raw)

[-- 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 --]

                 reply	other threads:[~2006-12-04 11:35 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20061204113549.GD31637@quickstop.soohrt.org \
    --to=horst@schirmeier.com \
    --cc=ak@suse.de \
    --cc=akpm@osdl.org \
    --cc=jbeulich@novell.com \
    --cc=jpdenheijer@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sam@ravnborg.org \
    /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 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.