Subject: Re: [PATCH] Support SPARSE in Makefile, better SPARSE_FLAGS

From: Pavel Roskin <[email-masked]>
Date: Fri, 30 Sep 2005 09:41:02 -0400

On Thu, 2005-09-29 at 22:46 -0700, Junio C Hamano wrote:
> Pavel Roskin <[email-masked]> writes:
> 
> > +# explicitly what architecture to check for.
> > +SPARSE = sparse
> > +SPARSE_FLAGS = -D__$(shell uname -i)__
> 
>         : siamese; uname --version
>         uname (coreutils) 5.2.1
>         Written by David MacKenzie.

Apparently my uname 5.2.1 was heavily patched by Fedora.  Note that
"uname -m" is not good enough, as it would give us i686 when i386 is
really needed.

>         Copyright (C) 2004 Free Software Foundation, Inc.
>         This is free software; see the source for copying conditions.
>         There is NO
>         warranty; not even for MERCHANTABILITY or FITNESS FOR A
>         PARTICULAR PURPOSE.
>         : siamese; uname -i
>         Try `uname --help' for more information.
> 
> Better alternatives?

I hate to say that, but a better alternative is to fix sparse to act
like the native compiler by default (possibly with options to imitate
other architectures or to be fully arch-neutral).

I have some hacks in mind, but I don't really like them:

Not good for i686 with unpatched uname:
SPARSE_FLAGS = __$(shell uname -i 2>/dev/null || uname -m)__

gcc specific:
SPARSE_FLAGS = __$(shell $CC -dumpmachine | sed 's/-.*//')__

bash specific:
SPARSE_FLAGS = __$(shell echo $$HOSTTYPE)__

In any case, having SPARSE variable would be convenient.

-- 
Regards,
Pavel Roskin