diff options
author | Suren A. Chilingaryan <csa@suren.me> | 2016-03-08 15:20:16 +0100 |
---|---|---|
committer | Suren A. Chilingaryan <csa@suren.me> | 2016-03-08 15:20:16 +0100 |
commit | 913b00b6e0db43115e69805c8640a744737fa4e5 (patch) | |
tree | 877f2a7251509cad404feb642d5526c5ca2dd12d | |
parent | 70aab572f4199391fd514a9e1a64af8b1a3b8324 (diff) | |
download | pcitool-913b00b6e0db43115e69805c8640a744737fa4e5.tar.gz pcitool-913b00b6e0db43115e69805c8640a744737fa4e5.tar.bz2 pcitool-913b00b6e0db43115e69805c8640a744737fa4e5.tar.xz pcitool-913b00b6e0db43115e69805c8640a744737fa4e5.zip |
Improve search routing looking up gcc suitable to compile kernel
-rw-r--r-- | driver/Makefile | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/driver/Makefile b/driver/Makefile index 1982635..d905ab0 100644 --- a/driver/Makefile +++ b/driver/Makefile @@ -24,11 +24,19 @@ default: 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 ;\ + newCC=gcc-$$KERNEL_GCC_VERSION ;\ CC=`which $$newCC 2>/dev/null` ;\ if [ $$? -ne 0 ]; then \ - echo "No compiler of $$GCC_MAJOR series is installed" ;\ - exit 1 ;\ + newCC=gcc-$$GCC_MAJOR ;\ + CC=`which $$newCC 2>/dev/null` ;\ + if [ $$? -ne 0 ]; then \ + newCC=`compgen -ac | grep -E ^gcc-4.6 | head -n 1` ;\ + CC=`which $$newCC 2>/dev/null` ;\ + if [ $$? -ne 0 ]; then \ + echo "No compiler of $$GCC_MAJOR series is installed" ;\ + exit 1 ;\ + fi ; \ + fi ;\ fi ;\ GCC_VERSION=`$$CC --version | head -n 1 | tr ' ' '\n' | grep -e "[0-9]\+\.[0-9]" | tail -n 1` ;\ if [ $$KERNEL_GCC_VERSION != $$GCC_VERSION -a -z "$$RELAXED_GCC_CHECK" ]; then \ |