From bd3d3af50f7e538ab6ee1974039896487dbcbea3 Mon Sep 17 00:00:00 2001 From: Timo Dritschler Date: Tue, 2 Mar 2021 16:41:38 +0100 Subject: Made GCC Version Detection in Driver Makefile more robust --- driver/Makefile.in | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/driver/Makefile.in b/driver/Makefile.in index e39d1fe..f521460 100644 --- a/driver/Makefile.in +++ b/driver/Makefile.in @@ -27,8 +27,11 @@ endif # Grepping in '../pcilib/build.h' is correct as we will always have this file in the releases... default: - @KERNEL_GCC_VERSION=`cat /proc/version | head -n1 | cut -d " " -f 7` ;\ - GCC_VERSION=`$(CC) --version | head -n 1 | tr ' ' '\n' | grep -e "[0-9]\+\.[0-9]" | tail -n 1` ;\ + @KERNEL_GCC_STRING=`cat /proc/version | head -n 1 | cut -d " " -f 7 | tr '-' '\n' | head -n 1` ;\ + KERNEL_GCC_VERSION=`echo $$KERNEL_GCC_STRING | grep -oe "[0-9]\+\.[0-9.]\+" | tail -n 1` ; \ + echo "Detected Kernel build GCC Version: $$KERNEL_GCC_VERSION" ;\ + GCC_VERSION=`$(CC) --version | head -n 1 | tr ' ' '\n' | grep -e "[0-9]\+\.[0-9.]\+" | tail -n 1` ;\ + echo "Detected installed GCC Version: $$GCC_VERSION" ;\ 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` ;\ -- cgit v1.2.1