Patchwork Makefile: Fix MinGW build, improve output with bogus CC

login
register
about
Submitter Uwe Hermann
Date 2011-08-19 08:06:47
Message ID <20110819080647.GA32722@greenwood>
Download mbox | patch
Permalink /patch/3361/
State Accepted
Headers show

Comments

Uwe Hermann - 2011-08-19 08:06:47
See patch.


Uwe.
Stefan Tauner - 2011-08-19 08:37:08
On Fri, 19 Aug 2011 10:06:47 +0200
Uwe Hermann <uwe@hermann-uwe.de> wrote:

> See patch.

thanks!
a space between | and grep might be nicer.
if no one vetoes until tomorrow 1100 CEST this is
Acked-by: Stefan Tauner <stefan.tauner@student.tuwien.ac.at>
Uwe Hermann - 2011-08-20 14:17:47
On Fri, Aug 19, 2011 at 10:37:08AM +0200, Stefan Tauner wrote:
> a space between | and grep might be nicer.

Yup, I wanted to do that anyway, but missed the spacebar, it seems.


> Acked-by: Stefan Tauner <stefan.tauner@student.tuwien.ac.at>

Thanks, r1418.


Uwe.

Patch

Makefile: Fix MinGW build, improve output with bogus CC.

As per IRC discussion, the "ARCH :=" line should be moved after any
lines which set CC, as it uses CC itself. This fixes the MinGW build.

Also, add a "2>/dev/null" in the "ARCH :=" as per suggestion from
Stefan Tauner to improve the output in the case CC is bogus:

Before:
$ make CC=foo
/bin/sh: foo: not found
Checking for a C compiler... not found.
make: *** [compiler] Error 1

After:
$ make CC=foo
Checking for a C compiler... not found.
make: *** [compiler] Error 1

Signed-off-by: Uwe Hermann <uwe@hermann-uwe.de>

Index: Makefile
===================================================================
--- Makefile	(Revision 1416)
+++ Makefile	(Arbeitskopie)
@@ -37,9 +37,6 @@ 
 CFLAGS += -Werror
 endif
 
-# Determine the destination processor architecture
-override ARCH := $(strip $(shell LC_ALL=C $(CC) -E arch.h|grep -v '^\#'))
-
 # FIXME We have to differentiate between host and target OS architecture.
 OS_ARCH	?= $(shell uname)
 ifneq ($(OS_ARCH), SunOS)
@@ -202,6 +199,12 @@ 
 endif
 endif
 
+# Determine the destination processor architecture.
+# IMPORTANT: The following line must be placed before ARCH is ever used
+# (of course), but should come after any lines setting CC because the line
+# below uses CC itself. In some cases we set CC based on OS_ARCH, see above.
+override ARCH := $(strip $(shell LC_ALL=C $(CC) -E arch.h 2>/dev/null |grep -v '^\#'))
+
 ifeq ($(ARCH), "ppc")
 # There's no PCI port I/O support on PPC/PowerPC, yet.
 ifeq ($(CONFIG_NIC3COM), yes)