* [PATCH] Makefile: Set CC/AR variable only if it doesn't have a value
@ 2016-01-03 18:54 Khem Raj
2016-01-04 13:39 ` Jeff Epler
2016-01-05 22:59 ` John Kacur
0 siblings, 2 replies; 12+ messages in thread
From: Khem Raj @ 2016-01-03 18:54 UTC (permalink / raw)
To: williams, jkacur; +Cc: linux-rt-users, Khem Raj
This helps it compile with clang or any other compilers besides gcc
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
Makefile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile
index 1e4b7d1..2c2d396 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
VERSION = 0.96
-CC=$(CROSS_COMPILE)gcc
-AR=$(CROSS_COMPILE)ar
+CC?=$(CROSS_COMPILE)gcc
+AR?=$(CROSS_COMPILE)ar
OBJDIR = bld
--
2.6.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH] Makefile: Set CC/AR variable only if it doesn't have a value
2016-01-03 18:54 [PATCH] Makefile: Set CC/AR variable only if it doesn't have a value Khem Raj
@ 2016-01-04 13:39 ` Jeff Epler
2016-01-04 14:40 ` Clark Williams
2016-01-04 16:20 ` Khem Raj
2016-01-05 22:59 ` John Kacur
1 sibling, 2 replies; 12+ messages in thread
From: Jeff Epler @ 2016-01-04 13:39 UTC (permalink / raw)
To: Khem Raj; +Cc: williams, jkacur, linux-rt-users
I believe the patch does not have the desired effect, because make(1)
always sets CC automatically:
$ cat raj.mk
CROSS_COMPILE=x86_64-linux-gnu-
CC?=$(CROSS_COMPILE)gcc
.PHONY: default
default:
@echo CC=$(CC)
$ make -f raj.mk
CC=cc
With your patch, those who specify CROSS_COMPILE, or for whom gcc and cc
are different, will get different (worse) behavior.
I believe this idea has been discussed before, but it is hard to search
for because few search engines will let you search on "CC ?=" and not
just ignore the "?=".
Also I am not sure why you are submitting this patch on -rt-users, it
doesn't seem to be particularly relevant to the RT patchset.
Jeff
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] Makefile: Set CC/AR variable only if it doesn't have a value
2016-01-04 13:39 ` Jeff Epler
@ 2016-01-04 14:40 ` Clark Williams
2016-01-05 3:12 ` Jeff Epler
2016-01-04 16:20 ` Khem Raj
1 sibling, 1 reply; 12+ messages in thread
From: Clark Williams @ 2016-01-04 14:40 UTC (permalink / raw)
To: Jeff Epler; +Cc: Khem Raj, jkacur, linux-rt-users
[-- Attachment #1: Type: text/plain, Size: 345 bytes --]
On Mon, 4 Jan 2016 07:39:04 -0600
Jeff Epler <jepler@unpythonic.net> wrote:
>
> Also I am not sure why you are submitting this patch on -rt-users, it
> doesn't seem to be particularly relevant to the RT patchset.
>
> Jeff
linux-rt-users also is for discussion of RT related user-space code, such as the rt-tests collection.
Clark
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 801 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] Makefile: Set CC/AR variable only if it doesn't have a value
2016-01-04 13:39 ` Jeff Epler
2016-01-04 14:40 ` Clark Williams
@ 2016-01-04 16:20 ` Khem Raj
2016-01-04 16:25 ` Uwe Kleine-König
2016-01-04 19:21 ` Arnout Vandecappelle
1 sibling, 2 replies; 12+ messages in thread
From: Khem Raj @ 2016-01-04 16:20 UTC (permalink / raw)
To: Jeff Epler; +Cc: williams, jkacur, linux-rt-users
[-- Attachment #1: Type: text/plain, Size: 1166 bytes --]
> On Jan 4, 2016, at 5:39 AM, Jeff Epler <jepler@unpythonic.net> wrote:
>
> I believe the patch does not have the desired effect, because make(1)
> always sets CC automatically:
>
> $ cat raj.mk
> CROSS_COMPILE=x86_64-linux-gnu-
> CC?=$(CROSS_COMPILE)gcc
> .PHONY: default
> default:
> @echo CC=$(CC)
> $ make -f raj.mk
> CC=cc
>
> With your patch, those who specify CROSS_COMPILE, or for whom gcc and cc
> are different, will get different (worse) behavior.
Right. I think if CC was used as such with out constructing out of CROSS_COMPILE
in Makefile then my issue would be fixed too. However this would mean that cross compiling users
now have to pass CC = <cross-compiler> themselves instead of CROSS_COMPILE prefix. Is that
acceptable ?
>
> I believe this idea has been discussed before, but it is hard to search
> for because few search engines will let you search on "CC ?=" and not
> just ignore the "?=".
>
> Also I am not sure why you are submitting this patch on -rt-users, it
> doesn't seem to be particularly relevant to the RT patchset.
See the MAINTAINERS file, I just followed whats in there.
>
> Jeff
[-- Attachment #2: Message signed with OpenPGP using GPGMail --]
[-- Type: application/pgp-signature, Size: 204 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] Makefile: Set CC/AR variable only if it doesn't have a value
2016-01-04 16:20 ` Khem Raj
@ 2016-01-04 16:25 ` Uwe Kleine-König
2016-01-05 21:15 ` Henrik Austad
2016-01-04 19:21 ` Arnout Vandecappelle
1 sibling, 1 reply; 12+ messages in thread
From: Uwe Kleine-König @ 2016-01-04 16:25 UTC (permalink / raw)
To: Khem Raj; +Cc: Jeff Epler, williams, jkacur, linux-rt-users
On Mon, Jan 04, 2016 at 08:20:01AM -0800, Khem Raj wrote:
>
> > On Jan 4, 2016, at 5:39 AM, Jeff Epler <jepler@unpythonic.net> wrote:
> >
> > I believe the patch does not have the desired effect, because make(1)
> > always sets CC automatically:
> >
> > $ cat raj.mk
> > CROSS_COMPILE=x86_64-linux-gnu-
> > CC?=$(CROSS_COMPILE)gcc
> > .PHONY: default
> > default:
> > @echo CC=$(CC)
> > $ make -f raj.mk
> > CC=cc
> >
> > With your patch, those who specify CROSS_COMPILE, or for whom gcc and cc
> > are different, will get different (worse) behavior.
>
> Right. I think if CC was used as such with out constructing out of CROSS_COMPILE
> in Makefile then my issue would be fixed too. However this would mean that cross compiling users
> now have to pass CC = <cross-compiler> themselves instead of CROSS_COMPILE prefix. Is that
> acceptable ?
You could play with something like:
ifeq($(origin CC),default)
CC=$(CROSS_COMPILE)gcc
endif
but not sure I'd like the result. If you asked me, I'd drop all that
CROSS_COMPILE stuff.
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
--
To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] Makefile: Set CC/AR variable only if it doesn't have a value
2016-01-04 16:20 ` Khem Raj
2016-01-04 16:25 ` Uwe Kleine-König
@ 2016-01-04 19:21 ` Arnout Vandecappelle
2016-01-04 23:13 ` Khem Raj
1 sibling, 1 reply; 12+ messages in thread
From: Arnout Vandecappelle @ 2016-01-04 19:21 UTC (permalink / raw)
To: Khem Raj, Jeff Epler; +Cc: williams, jkacur, linux-rt-users
[-- Attachment #1: Type: text/plain, Size: 1507 bytes --]
On 04-01-16 17:20, Khem Raj wrote:
>> On Jan 4, 2016, at 5:39 AM, Jeff Epler <jepler@unpythonic.net> wrote:
>> >
>> > I believe the patch does not have the desired effect, because make(1)
>> > always sets CC automatically:
>> >
>> > $ cat raj.mk
>> > CROSS_COMPILE=x86_64-linux-gnu-
>> > CC?=$(CROSS_COMPILE)gcc
>> > .PHONY: default
>> > default:
>> > @echo CC=$(CC)
>> > $ make -f raj.mk
>> > CC=cc
>> >
>> > With your patch, those who specify CROSS_COMPILE, or for whom gcc and cc
>> > are different, will get different (worse) behavior.
> Right. I think if CC was used as such with out constructing out of CROSS_COMPILE
> in Makefile then my issue would be fixed too. However this would mean that cross compiling users
> now have to pass CC = <cross-compiler> themselves instead of CROSS_COMPILE prefix. Is that
> acceptable ?
But what is really your issue? Even after this patch, you'll have to run
make CC=<path-to-clang> AR=<path-to-clang-ar>
and this will already override it in the current situation.
Regards,
Arnout
--
Arnout Vandecappelle arnout dot vandecappelle at essensium dot com
Senior Embedded Software Architect . . . . . . +32-478-010353 (mobile)
Essensium, Mind division . . . . . . . . . . . . . . http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium . . . . . BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] Makefile: Set CC/AR variable only if it doesn't have a value
2016-01-04 19:21 ` Arnout Vandecappelle
@ 2016-01-04 23:13 ` Khem Raj
0 siblings, 0 replies; 12+ messages in thread
From: Khem Raj @ 2016-01-04 23:13 UTC (permalink / raw)
To: Arnout Vandecappelle; +Cc: Jeff Epler, williams, jkacur, linux-rt-users
On Mon, Jan 4, 2016 at 11:21 AM, Arnout Vandecappelle
<arnout.vandecappelle@essensium.com> wrote:
> On 04-01-16 17:20, Khem Raj wrote:
>>> On Jan 4, 2016, at 5:39 AM, Jeff Epler <jepler@unpythonic.net> wrote:
>>> >
>>> > I believe the patch does not have the desired effect, because make(1)
>>> > always sets CC automatically:
>>> >
>>> > $ cat raj.mk
>>> > CROSS_COMPILE=x86_64-linux-gnu-
>>> > CC?=$(CROSS_COMPILE)gcc
>>> > .PHONY: default
>>> > default:
>>> > @echo CC=$(CC)
>>> > $ make -f raj.mk
>>> > CC=cc
>>> >
>>> > With your patch, those who specify CROSS_COMPILE, or for whom gcc and cc
>>> > are different, will get different (worse) behavior.
>> Right. I think if CC was used as such with out constructing out of CROSS_COMPILE
>> in Makefile then my issue would be fixed too. However this would mean that cross compiling users
>> now have to pass CC = <cross-compiler> themselves instead of CROSS_COMPILE prefix. Is that
>> acceptable ?
>
> But what is really your issue? Even after this patch, you'll have to run
>
> make CC=<path-to-clang> AR=<path-to-clang-ar>
>
> and this will already override it in the current situation.
currently it ignores CC from environment. So there is no way to
specify a compiler which is not called {something}gcc
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] Makefile: Set CC/AR variable only if it doesn't have a value
2016-01-04 14:40 ` Clark Williams
@ 2016-01-05 3:12 ` Jeff Epler
0 siblings, 0 replies; 12+ messages in thread
From: Jeff Epler @ 2016-01-05 3:12 UTC (permalink / raw)
To: Clark Williams; +Cc: Khem Raj, jkacur, linux-rt-users
On Mon, Jan 04, 2016 at 08:40:16AM -0600, Clark Williams wrote:
> linux-rt-users also is for discussion of RT related user-space code, such as the rt-tests collection.
>
> Clark
I apologize. I didn't read the original patch closely enough and
incorrectly believed it was a proposed patch for the top-level Makefile
in the linux kernel source tree.
Jeff
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] Makefile: Set CC/AR variable only if it doesn't have a value
2016-01-04 16:25 ` Uwe Kleine-König
@ 2016-01-05 21:15 ` Henrik Austad
2016-01-05 21:20 ` Khem Raj
2016-01-05 21:42 ` Uwe Kleine-König
0 siblings, 2 replies; 12+ messages in thread
From: Henrik Austad @ 2016-01-05 21:15 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Khem Raj, Jeff Epler, williams, jkacur, linux-rt-users
[-- Attachment #1: Type: text/plain, Size: 1517 bytes --]
On Mon, Jan 04, 2016 at 05:25:07PM +0100, Uwe Kleine-König wrote:
> On Mon, Jan 04, 2016 at 08:20:01AM -0800, Khem Raj wrote:
> >
> > > On Jan 4, 2016, at 5:39 AM, Jeff Epler <jepler@unpythonic.net> wrote:
> > >
> > > I believe the patch does not have the desired effect, because make(1)
> > > always sets CC automatically:
> > >
> > > $ cat raj.mk
> > > CROSS_COMPILE=x86_64-linux-gnu-
> > > CC?=$(CROSS_COMPILE)gcc
> > > .PHONY: default
> > > default:
> > > @echo CC=$(CC)
> > > $ make -f raj.mk
> > > CC=cc
> > >
> > > With your patch, those who specify CROSS_COMPILE, or for whom gcc and cc
> > > are different, will get different (worse) behavior.
> >
> > Right. I think if CC was used as such with out constructing out of CROSS_COMPILE
> > in Makefile then my issue would be fixed too. However this would mean that cross compiling users
> > now have to pass CC = <cross-compiler> themselves instead of CROSS_COMPILE prefix. Is that
> > acceptable ?
>
> You could play with something like:
>
> ifeq($(origin CC),default)
> CC=$(CROSS_COMPILE)gcc
> endif
>
> but not sure I'd like the result. If you asked me, I'd drop all that
> CROSS_COMPILE stuff.
Why? Isn't this the normal way of triggering cross-compile? AFIAK, that's
how the kernel does it, and that seems like a pretty sane way.
And yes, I compile rt-tests to several architectures, so I'm quite fond of
the CROSS_COMPILE switch. In fact, I might get cross if you cross it out :)
--
Henrik Austad
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] Makefile: Set CC/AR variable only if it doesn't have a value
2016-01-05 21:15 ` Henrik Austad
@ 2016-01-05 21:20 ` Khem Raj
2016-01-05 21:42 ` Uwe Kleine-König
1 sibling, 0 replies; 12+ messages in thread
From: Khem Raj @ 2016-01-05 21:20 UTC (permalink / raw)
To: Henrik Austad
Cc: Uwe Kleine-König, Jeff Epler, williams, jkacur, linux-rt-users
[-- Attachment #1: Type: text/plain, Size: 1756 bytes --]
> On Jan 5, 2016, at 1:15 PM, Henrik Austad <henrik@austad.us> wrote:
>
> On Mon, Jan 04, 2016 at 05:25:07PM +0100, Uwe Kleine-König wrote:
>> On Mon, Jan 04, 2016 at 08:20:01AM -0800, Khem Raj wrote:
>>>
>>>> On Jan 4, 2016, at 5:39 AM, Jeff Epler <jepler@unpythonic.net> wrote:
>>>>
>>>> I believe the patch does not have the desired effect, because make(1)
>>>> always sets CC automatically:
>>>>
>>>> $ cat raj.mk
>>>> CROSS_COMPILE=x86_64-linux-gnu-
>>>> CC?=$(CROSS_COMPILE)gcc
>>>> .PHONY: default
>>>> default:
>>>> @echo CC=$(CC)
>>>> $ make -f raj.mk
>>>> CC=cc
>>>>
>>>> With your patch, those who specify CROSS_COMPILE, or for whom gcc and cc
>>>> are different, will get different (worse) behavior.
>>>
>>> Right. I think if CC was used as such with out constructing out of CROSS_COMPILE
>>> in Makefile then my issue would be fixed too. However this would mean that cross compiling users
>>> now have to pass CC = <cross-compiler> themselves instead of CROSS_COMPILE prefix. Is that
>>> acceptable ?
>>
>> You could play with something like:
>>
>> ifeq($(origin CC),default)
>> CC=$(CROSS_COMPILE)gcc
>> endif
>>
>> but not sure I'd like the result. If you asked me, I'd drop all that
>> CROSS_COMPILE stuff.
>
> Why? Isn't this the normal way of triggering cross-compile? AFIAK, that's
> how the kernel does it, and that seems like a pretty sane way.
except, kernel lets you override CC if you want to.
>
> And yes, I compile rt-tests to several architectures, so I'm quite fond of
> the CROSS_COMPILE switch. In fact, I might get cross if you cross it out :)
All you would need is to add
CC = ${CROSS_COMPILE}gcc in one place in your Make env
>
> --
> Henrik Austad
[-- Attachment #2: Message signed with OpenPGP using GPGMail --]
[-- Type: application/pgp-signature, Size: 204 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] Makefile: Set CC/AR variable only if it doesn't have a value
2016-01-05 21:15 ` Henrik Austad
2016-01-05 21:20 ` Khem Raj
@ 2016-01-05 21:42 ` Uwe Kleine-König
1 sibling, 0 replies; 12+ messages in thread
From: Uwe Kleine-König @ 2016-01-05 21:42 UTC (permalink / raw)
To: Henrik Austad; +Cc: Khem Raj, Jeff Epler, williams, jkacur, linux-rt-users
Hello Henrik,
On Tue, Jan 05, 2016 at 10:15:56PM +0100, Henrik Austad wrote:
> On Mon, Jan 04, 2016 at 05:25:07PM +0100, Uwe Kleine-König wrote:
> > On Mon, Jan 04, 2016 at 08:20:01AM -0800, Khem Raj wrote:
> > >
> > > > On Jan 4, 2016, at 5:39 AM, Jeff Epler <jepler@unpythonic.net> wrote:
> > > >
> > > > I believe the patch does not have the desired effect, because make(1)
> > > > always sets CC automatically:
> > > >
> > > > $ cat raj.mk
> > > > CROSS_COMPILE=x86_64-linux-gnu-
> > > > CC?=$(CROSS_COMPILE)gcc
> > > > .PHONY: default
> > > > default:
> > > > @echo CC=$(CC)
> > > > $ make -f raj.mk
> > > > CC=cc
> > > >
> > > > With your patch, those who specify CROSS_COMPILE, or for whom gcc and cc
> > > > are different, will get different (worse) behavior.
> > >
> > > Right. I think if CC was used as such with out constructing out of CROSS_COMPILE
> > > in Makefile then my issue would be fixed too. However this would mean that cross compiling users
> > > now have to pass CC = <cross-compiler> themselves instead of CROSS_COMPILE prefix. Is that
> > > acceptable ?
> >
> > You could play with something like:
> >
> > ifeq($(origin CC),default)
> > CC=$(CROSS_COMPILE)gcc
> > endif
> >
> > but not sure I'd like the result. If you asked me, I'd drop all that
> > CROSS_COMPILE stuff.
>
> Why? Isn't this the normal way of triggering cross-compile? AFIAK, that's
> how the kernel does it, and that seems like a pretty sane way.
No, the normal thing to trigger a cross-compile is
./configure --build=amd64 --host=mips-elf
:-)
For plain make project with no special support for cross compiling
(which is the norm today), the right incarnation is:
make CC=arm-v5te-linux-gnueabi-gcc
and IMHO that's good enough. (Sometimes you also have to pass CXX, in
rare cases even more.)
> And yes, I compile rt-tests to several architectures, so I'm quite fond of
> the CROSS_COMPILE switch. In fact, I might get cross if you cross it out :)
I don't care much, because if I cross compile rt-tests someone else
already found out for me how to do it, I only have to enable it in my
config :-)
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
--
To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] Makefile: Set CC/AR variable only if it doesn't have a value
2016-01-03 18:54 [PATCH] Makefile: Set CC/AR variable only if it doesn't have a value Khem Raj
2016-01-04 13:39 ` Jeff Epler
@ 2016-01-05 22:59 ` John Kacur
1 sibling, 0 replies; 12+ messages in thread
From: John Kacur @ 2016-01-05 22:59 UTC (permalink / raw)
To: Khem Raj; +Cc: williams, linux-rt-users
On Sun, 3 Jan 2016, Khem Raj wrote:
> This helps it compile with clang or any other compilers besides gcc
>
> Signed-off-by: Khem Raj <raj.khem@gmail.com>
> ---
> Makefile | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index 1e4b7d1..2c2d396 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1,6 +1,6 @@
> VERSION = 0.96
> -CC=$(CROSS_COMPILE)gcc
> -AR=$(CROSS_COMPILE)ar
> +CC?=$(CROSS_COMPILE)gcc
> +AR?=$(CROSS_COMPILE)ar
>
> OBJDIR = bld
>
> --
Signed-off-by: John Kacur <jkacur@gmail.com>
I added this to the next build.
Note, I read everything in the thread, and I think there was a bit of
confusion over thinking this was a kernel Makefile and not
the rt-tests one. As clark said, this is indeed the appropriate place to
discuss user space tools that are to do with real-time.
Perhaps after [PATCH] add rt-tests: to make it clear.
This patch is fine, it changes nothing other than letting the Khem and
others specify CC and AR from the command line when typing make.
Thanks
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2016-01-05 22:59 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-03 18:54 [PATCH] Makefile: Set CC/AR variable only if it doesn't have a value Khem Raj
2016-01-04 13:39 ` Jeff Epler
2016-01-04 14:40 ` Clark Williams
2016-01-05 3:12 ` Jeff Epler
2016-01-04 16:20 ` Khem Raj
2016-01-04 16:25 ` Uwe Kleine-König
2016-01-05 21:15 ` Henrik Austad
2016-01-05 21:20 ` Khem Raj
2016-01-05 21:42 ` Uwe Kleine-König
2016-01-04 19:21 ` Arnout Vandecappelle
2016-01-04 23:13 ` Khem Raj
2016-01-05 22:59 ` John Kacur
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.