[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 1/5] make: simplify setting HOST{CC/CXX}



On Fri, Jun 28, 2019 at 09:29:53AM +0000, Jan Beulich wrote:
>  >>> On 26.06.19 at 15:55, <roger.pau@xxxxxxxxxx> wrote:
>  > --- a/Config.mk
>  > +++ b/Config.mk
>  > @@ -39,22 +39,12 @@ DESTDIR     ?= /
>  >  # Allow phony attribute to be listed as dependency rather than fake 
> target
>  >  .PHONY: .phony
>  >
>  > -# If we are not cross-compiling, default HOSTC{C/XX} to C{C/XX}
>  > -ifeq ($(XEN_TARGET_ARCH), $(XEN_COMPILE_ARCH))
>  > -HOSTCC ?= $(CC)
>  > -HOSTCXX ?= $(CXX)
>  > -endif
>  > -
>  >  # Use Clang/LLVM instead of GCC?
>  >  clang ?= n
>  >  ifeq ($(clang),n)
>  >  gcc := y
>  > -HOSTCC ?= gcc
>  > -HOSTCXX ?= g++
>  >  else
>  >  gcc := n
>  > -HOSTCC ?= clang
>  > -HOSTCXX ?= clang++
>  >  endif
> 
> The inclusion point leading to config/StdGNU.mk sits below
> here afaict, so I don't see how ...
> 
>  > --- a/config/StdGNU.mk
>  > +++ b/config/StdGNU.mk
>  > @@ -9,6 +9,10 @@ CC        ?= $(CROSS_COMPILE)gcc
>  >  CXX       ?= $(CROSS_COMPILE)g++
>  >  LD_LTO    ?= $(CROSS_COMPILE)ld
>  >  endif
>  > +
>  > +HOSTCC    ?= $(CC)
>  > +HOSTCXX   ?= $(CXX)
> 
> ... these are every going to take effect - the two variables aren't
> unset anymore at that point.

I'm not sure I follow, after this change the only place where
HOST{CC/CXX} are set is in StdGNU.mk, so those variables would be
unset unless they are set in the environment.

> Furthermore, when CROSS_COMPILE
> is not empty, this is certainly not what we want.

TBH I would like some guidelines about how CROSS_COMPILE is supposed
to be used.

I agree the above is not very nice when CROSS_COMPILE is set. What
about something like:

ifeq ($(clang),y)
CC        ?= clang
CXX       ?= clang++
LD_LTO    ?= llvm-ld
HOSTCC    ?= $(CC)
HOSTCXX   ?= $(CXX)
CC         = $(CROSS_COMPILE)$(CC)
CXX        = $(CROSS_COMPILE)$(CXX)
LD_LTO     = $(CROSS_COMPILE)$(LD_LTO)
else
[...]

That would keep the current behaviour of setting CC=gcc
CROSS_COMPILE=arm-linux-gnueabi-, which my previous approach didn't.

Thanks, Roger.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.