lkml.org 
[lkml]   [2011]   [Mar]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH trace-cmd 3/3] Revert "trace-cmd: Use conditional assignment of CC and AR"
On 03/09/2011 09:25 PM, David Sharp wrote:
> On Wed, Mar 9, 2011 at 7:26 PM, Steven Rostedt<rostedt@goodmis.org> wrote:
>> On Wed, 2011-03-09 at 21:51 -0500, Steven Rostedt wrote:
>>
>>> I'll play with some other make tricks and see if I can come up with a
>>> better solution.
>>
>> OK, it didn't take me long to come up with "Makefiles suck" ;)
>
> Yes, except for very basic things.
>
>>
>> But I did come up with a solution:
>>
>> ifneq ("$(origin CC)", "environment")
>> CC = gcc
>> endif
>>
>> CC := $(CROSS_COMPILE)$(CC)
>>
>> This wont let make CC=xx work unless I also add a:
>>
>> ifneq ("$(origin CC)", "command line")
>>
>> around the above if, but do we care?
>>
>> -- Steve
>
> This seems to do it all:
>
> define allow-override
> $(if $(or $(findstring environment,$(origin $(1))),
> $(findstring command line,$(origin $(1)))),,\
> $(eval $(1) = $(2)))
> endef
>
> $(call allow-override,CC,$(CROSS_COMPILE)gcc)
> $(call allow-override,AR,$(CROSS_COMPILE)ar)

Egads .... that's hideous :-) This level of complexity makes it very
difficult for people to readily understand it. What does this offer over:
ifdef CROSS_COMPILE
CC = $(CROSS_COMPILE)gcc
AR = $(CROSS_COMPILE)ar
endif

besides being 3 lines longer with much more complex Makefile syntax and
conditional statements?

--
Darren Hart
Intel Open Source Technology Center
Yocto Project - Linux Kernel


\
 
 \ /
  Last update: 2011-03-10 07:49    [from the cache]
©2003-2011 Jasper Spaans