From 810a7d3644988a00f48f9469dae05b6ae3f8ab1b Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Thu, 6 Mar 2008 09:45:28 -0800 Subject: [PATCH] Don't treat $(CC) as a list of compiler candidates if provided by user. Otherwise, if a multi-word $(CC) is provided by the user, such as "gcc -m32", then we test each word as a compiler. "-m32" then gives you an error from the shell about "-3" not being a valid option. --- datapath/linux-2.6/kbuild.inc | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/datapath/linux-2.6/kbuild.inc b/datapath/linux-2.6/kbuild.inc index c3102d61..92f8026e 100644 --- a/datapath/linux-2.6/kbuild.inc +++ b/datapath/linux-2.6/kbuild.inc @@ -36,7 +36,13 @@ endif # Environment tests ifeq (,$(CC)) - CC := gcc cc + CC_CANDIDATES := gcc cc + test_cc = $(shell $(cc) --version > /dev/null 2>&1 && echo $(cc)) + CC := $(foreach cc,$(CC_CANDIDATES), $(test_cc)) + CC := $(firstword $(CC)) + ifeq (,$(CC)) + $(error Compiler not found) + endif endif ifeq (,$(KSRC)) @@ -95,13 +101,6 @@ ifeq (,$(wildcard $(CONFIG_FILE))) endif -test_cc = $(shell $(cc) --version > /dev/null 2>&1 && echo $(cc)) -CC := $(foreach cc, $(CC), $(test_cc)) -CC := $(firstword $(CC)) -ifeq (,$(CC)) - $(error Compiler not found) -endif - # we need to know what platform the driver is being built on # some additional features are only built on Intel platforms ifeq ($(ARCH),) -- 2.30.2