2007-02-08 03:30:59

by Roland McGrath

[permalink] [raw]
Subject: [PATCH] fix cc-option-yn whitespace

This change:

commit 5de043f4bd11a9e0a3e8daec7d1905da575a76b7
Author: Oleg Verych <[email protected]>
Date: Tue Feb 6 02:18:21 2007 +0100

[PATCH] kbuild: improve option checking, Kbuild.include cleanup

introduced leading whitespace in the results of cc-option-yn and such.
This breaks some of their uses, like HAS_MTUNE in arch/i386/Makefile.cpu.

This patch fixes the regression.

Signed-off-by: Roland McGrath <[email protected]>
---
scripts/Kbuild.include | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
index 96926eb..931d52f 100644
--- a/scripts/Kbuild.include
+++ b/scripts/Kbuild.include
@@ -60,6 +60,7 @@ endef
# Usage: option = $(call checker-shell, $(CC)...-o $$OUT, option-ok, otherwise)
# Exit code chooses option. $$OUT is safe location for needless output.
define checker-shell
+$(strip \
$(shell set -e; \
DIR=$(KBUILD_EXTMOD); \
cd $${DIR:-$(objtree)}; \
@@ -70,7 +71,7 @@ define checker-shell
then echo "$(2)"; \
else echo "$(3)"; \
fi; \
- rm -f $$OUT)
+ rm -f $$OUT))
endef

# as-option


2007-02-08 04:34:34

by Linus Torvalds

[permalink] [raw]
Subject: Re: [PATCH] fix cc-option-yn whitespace



On Wed, 7 Feb 2007, Roland McGrath wrote:

> This change:
>
> commit 5de043f4bd11a9e0a3e8daec7d1905da575a76b7
> Author: Oleg Verych <[email protected]>
> Date: Tue Feb 6 02:18:21 2007 +0100
>
> [PATCH] kbuild: improve option checking, Kbuild.include cleanup
>
> introduced leading whitespace in the results of cc-option-yn and such.
> This breaks some of their uses, like HAS_MTUNE in arch/i386/Makefile.cpu.

Yes.. It doesn't seem to happen with make-3.81, for some reason, and I
don't see why the leading space happens. Maybe somebody with deep GNU make
knowledge knows.

I committed the hopefully equivalent patch (that also removes the
symlinking to /dev/null that Roman objected to).

Linus

2007-02-08 20:06:48

by Roland McGrath

[permalink] [raw]
Subject: Re: [PATCH] fix cc-option-yn whitespace

> Yes.. It doesn't seem to happen with make-3.81, for some reason, and I
> don't see why the leading space happens. Maybe somebody with deep GNU make
> knowledge knows.

You probably think that's me, but thankfully I have succeeded in forgetting
more about GNU make than anyone else knew. I wouldn't be much surprised if
3.81 changed some details about whitespace in `call', or in `define', or
something else like that; people keep diddling with make. At least in the
world I knew, only whitespace after an = or := is stripped like you might
have been expecting, and not whitespace after commas (I mean, why else
would make have the `strip' function?). All of the $(call foo, a, b) uses
introduce whitespace (vs $(call foo,a,b)). It's been luck, or silent
careful tweaking, that's made all those work out right so far. Note also
that the new form of cc-option-yn results in:
then echo " "y""; \
else echo " "n""; \
in those commands. Some other uses of the functions turned into
checker-shell uses might have doubled quotes (i.e. unquoted text) now too.
(People always think make is sh, but it's m4.)

I have long ago sworn off thinking too hard about other people's makefiles
that get arcane with GNU make features. (You don't feel compelled to watch
every piece of porn on the net that people use Linux to get there, do you?)
So I just did the minimal tweak to fix the concrete regression, though I'd
have to say that the "cleanup" has made things messier and more obfuscated.


Thanks,
Roland

2007-02-08 20:45:59

by Oleg Verych

[permalink] [raw]
Subject: Re: [PATCH] fix cc-option-yn whitespace

> From: Roland McGrath <[email protected]>
> Newsgroups: gmane.linux.kernel
> Subject: Re: [PATCH] fix cc-option-yn whitespace
> Date: Thu, 8 Feb 2007 12:06:35 -0800 (PST)

[]
> I have long ago sworn off thinking too hard about other people's makefiles
> that get arcane with GNU make features. (You don't feel compelled to watch
> every piece of porn on the net that people use Linux to get there, do you?)

> So I just did the minimal tweak to fix the concrete regression, though I'd
> have to say that the "cleanup" has made things messier and more obfuscated.

Well, "refactoring". I think, it's hard to disagree, how messy $(CC) was
called there.

Thus, i tried to turn `m4' to `sh', because it's `sh' who does job. With
help of the mentors, it's done now. Good kick-start after stability
kernel release, nobody should relax (:.

Thanks.
____