summaryrefslogtreecommitdiffstats
path: root/driver/Makefile
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@dside.dyndns.org>2012-07-04 18:07:02 +0200
committerSuren A. Chilingaryan <csa@dside.dyndns.org>2012-07-04 18:07:02 +0200
commit9cf24e3beeb087bd98950d4bbf038e7019c25890 (patch)
tree7f76741d012917b636a5b59160bb9356c7423987 /driver/Makefile
parentbefb48615d5c4b90f56e52ed436fe32bea9f11a3 (diff)
parent0c0934bc67cf32458f80c0ebf2c416c3e6d4e9e7 (diff)
downloadpcitool-9cf24e3beeb087bd98950d4bbf038e7019c25890.tar.gz
pcitool-9cf24e3beeb087bd98950d4bbf038e7019c25890.tar.bz2
pcitool-9cf24e3beeb087bd98950d4bbf038e7019c25890.tar.xz
pcitool-9cf24e3beeb087bd98950d4bbf038e7019c25890.zip
merge gcc-verification and update to linux-3.2
Diffstat (limited to 'driver/Makefile')
-rw-r--r--driver/Makefile22
1 files changed, 21 insertions, 1 deletions
diff --git a/driver/Makefile b/driver/Makefile
index 9eedc1e..ac4a14c 100644
--- a/driver/Makefile
+++ b/driver/Makefile
@@ -9,7 +9,27 @@ PWD := $(shell pwd)
EXTRA_CFLAGS += -I$(M)/..
default:
- $(MAKE) $(CFLAGS) -C $(KERNELDIR) M=$(PWD) modules
+ @KERNEL_GCC_VERSION=`cat /proc/version | head -n1 | cut -d " " -f 7` ;\
+ GCC_VERSION=`$(CC) --version | head -n 1 | awk 'BEGIN { FPAT = "([^[:space:]]*)|(\\\\([^)]+\\\\))" } { print $$3 }'` ;\
+ if [ $$KERNEL_GCC_VERSION != $$GCC_VERSION ]; then \
+ echo "Kernel is compiled with gcc $$KERNEL_GCC_VERSION, but you are now using $$GCC_VERSION" ;\
+ GCC_MAJOR=`echo $$KERNEL_GCC_VERSION | cut -d "." -f 1-2` ;\
+ newCC=gcc-$$GCC_MAJOR ;\
+ CC=`which $$newCC 2>/dev/null` ;\
+ if [ $$? -ne 0 ]; then \
+ echo "No compiler of $$GCC_MAJOR series is installed" ;\
+ exit 1 ;\
+ fi ;\
+ GCC_VERSION=`$$CC --version | head -n 1 | awk 'BEGIN { FPAT = "([^[:space:]]*)|(\\\\([^)]+\\\\))" } { print $$3 }'` ;\
+ if [ $$KERNEL_GCC_VERSION != $$GCC_VERSION ]; then \
+ echo "The $$GCC_VERSION of $$GCC_MAJOR series is installed" ;\
+ exit 1 ;\
+ fi ;\
+ echo "Setting CC to $$newCC" ;\
+ else \
+ CC=$(CC) ;\
+ fi ;\
+ $(MAKE) $(CFLAGS) -C $(KERNELDIR) M=$(PWD) CC=$$CC modules
install:
@mkdir -p $(INSTALLDIR)