Re: [msysGit] Re: [PATCH 14/14] MINGW: config.mak.uname: auto-detect MinGW build from compiler

2014-10-09 Thread Johannes Schindelin
Hi Junio,

On Thu, 9 Oct 2014, Junio C Hamano wrote:

 Marat Radchenko ma...@slonopotamus.org writes:
 
  On Wed, Oct 08, 2014 at 12:26:52PM -0700, Junio C Hamano wrote:
  ...
  What I am wondering is if it is a better solution to make it easier
  to allow somebody who is cross compiling to express Mr.  Makefile,
  we know better than you and want you to do a MINGW build for us
  without checking with `uname -?` yourself, i.e.
  
 $ make uname_O=MINGW uname_S=MINGW
  
  which would hopefully allow cross-compilation into other
  environments, not just MINGW.
 
  So, do you really want this patch to be changed from 5-liner into
  a full-blow system detection rewrite based on `cc -dumpmachine`
  instead of `uname`?
 
 No, and I do not quite see why you even need to look at -dumbmachine

Nice Freudian ;-)

 output when your goal is to make this command line
 
 $ make uname_O=MINGW uname_S=MINGW
 
 work sensibly.  Wouldn't it be more like a series of
 
   ifndef uname_O
 uname_O := $(shell uname -o)
   endif
 
 or something like that?

Or uname_O ?= $(shell uname -o)

To clarify: it would be enough to look at CROSS_COMPILE to determine
whether we're cross-compiling for MinGW.

The output of -dumpmachine is still needed for the correct CFLAGS/LDFLAGS.

Ciao,
Dscho
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [msysGit] Re: [PATCH 14/14] MINGW: config.mak.uname: auto-detect MinGW build from compiler

2014-10-09 Thread Johannes Schindelin
Hi Junio,

On Thu, 9 Oct 2014, Junio C Hamano wrote:

 Isn't the primary reason we use colon-assign to avoid running the same
 $(shell) over and over again every time $(uname_?) gets referenced? How
 would it work with ?= ???

I was under the impression that ?= would only define the variable once,
the next time ?= would be encountered, no assignment (and actually, no
evaluation) would take place because the variable already has a value?

According to

https://www.gnu.org/software/make/manual/make.html#index-_003f_003d

FOO ?= bar

is exactly equivalent to this (see The origin Function):

ifeq ($(origin FOO), undefined)
  FOO = bar
endif

 Pardon misspellings and grammos, typed on a tablet.

No worries. But you really should use your tablet for reading books after
midnight instead of doing work... ;-)

Ciao,
Dscho
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [msysGit] Re: [PATCH 14/14] MINGW: config.mak.uname: auto-detect MinGW build from compiler

2014-10-09 Thread Johannes Schindelin
Hi Junio,

On Thu, 9 Oct 2014, Junio C Hamano wrote:

 I didn't mean multiple uses of ?= for the same variable. I meant
 multiple uses of (references to) the variable. I.e. wouldn't FOO and
 BAR behave differently below?
 
 FOO := $(shell random)
 BAR = $(shell random)
 all::
echo $(FOO) and $(BAR)
echo twice $(FOO) and $(BAR)

You're correct, of course, my mistake. I just tested with this:

R ?= $(shell echo $$RANDOM)

all:
echo The values of $(R), $(R) and $(R)

and of course a make yields three different numbers. Sorry for missing
that.

So what we should do is something like

ifeq ($(uname_S),)
uname_S := $(shell uname -s)
endif

even if repeating that pattern is kind of ugly...

Thanks for correcting my mistake,
Dscho
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html