Subject: Re: [PATCH v2] parisc: dont unconditionally override CROSS_COMPILE for 64 bit.

From: Mike Frysinger <[email-masked]>
Date: Tue, 28 Feb 2012 10:21:02 -0500

On Tuesday 28 February 2012 09:10:45 James Bottomley wrote:
> On Tue, 2012-02-28 at 01:06 -0500, Mike Frysinger wrote:
> > On Monday 27 February 2012 22:17:01 James Bottomley wrote:
> > > On Mon, 2012-02-27 at 20:04 -0500, Mike Frysinger wrote:
> > > > On Monday 27 February 2012 17:03:10 James Bottomley wrote:
> > > > > --- a/arch/parisc/Makefile
> > > > > +++ b/arch/parisc/Makefile
> > > > > 
> > > > > -CROSS_COMPILE	:= hppa64-linux-gnu-
> > > > > +
> > > > > +# if no default set, try to find the corresponding 64 bit compiler
> > > > > +ifeq ($(CROSS_COMPILE),)
> > > > > +CROSS_COMPILE	:= $(shell $(CC) -dumpmachine | sed
> > > > > s/hppa-\\\(.*\\\)/hppa64-\\1-/) +endif
> > > > 
> > > > fails when using "hppa2.0-xxx".  perhaps:
> 
> Is that a valid prefix?  I was thinking hppa32 might be, but hppa2.0 is
> supposed to be hppa-xxx with -mpa-risc-2-0.

we've been using hppa2.0 for years.  gnuconfig certainly recognizes it:
$ grep hppa /usr/share/gnuconfig/config.sub 
        | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
        | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \

and i've seen diff projects key off of the hppa2.0* to enable newer features by 
default.

> But anyway, I think being clever and removing unused stuff is likely
> orthogonal to the first patch which is just making it all work.

sure, but your new patch added the sed :)

> > > The reason it doesn't work is the same ... CROSS_COMPILE is defined to
> > > be empty.
> > 
> > my suggestion was purely an incremental improvement on the patch you
> > posted.
> > 
> > it improves two things:
> > 	- detection when the default tuple is hppa2.0-xxx rather than hppa-xxx
> > 	- one line for set-variable-only-when-its-unset rather than three lines
> 
> It can't be done ... defined but empty is different from not defined in
> makefiles (ifdef or ?= only checks for not defined).  CROSS_COMPILE gets
> automatically defined by the top level Makefile ... that's why we need a
> check for empty not a check for not defined.

yeah, OK ... this behavior changed from what i was remembering.  ?= used to 
work until the top level Makefile was improved.
-mike