Re: [PATCH trace-cmd 3/3] Revert "trace-cmd: Use conditionalassignment of CC and AR"

From: Steven Rostedt
Date: Thu Mar 10 2011 - 08:02:48 EST


On Wed, 2011-03-09 at 22:46 -0800, Darren Hart wrote:

> > 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:

Love the world of makefiles ;) Nothing that comments wont solve.

>
> 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?

Yes, the above is simple and solves the issue for both you and David,
but it has a side-effect that David already pointed out. CC is now cc
and not gcc. I don't like that, as I do have systems that cc is
different that gcc and I want to use gcc.

But if I define CROSS_COMPILE it then suddenly uses gcc. Yes this may
not seem like a big deal now, but in the future, it could cause a lot of
headache. I rather have the more complex yet correct solution that is
consistent than a simple easy to read solution with a subtle side-effect
that is hidden.

-- Steve


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/