nps: Makefile, poci/Makefile - sane detection of kernel version
baggins
baggins at pld-linux.org
Mon Aug 1 19:52:40 CEST 2005
Author: baggins Date: Mon Aug 1 17:52:40 2005 GMT
Module: nps Tag: HEAD
---- Log message:
- sane detection of kernel version
---- Files affected:
nps:
Makefile (1.4 -> 1.5)
nps/poci:
Makefile (1.1 -> 1.2)
---- Diffs:
================================================================
Index: nps/Makefile
diff -u nps/Makefile:1.4 nps/Makefile:1.5
--- nps/Makefile:1.4 Sun Jul 31 01:56:01 2005
+++ nps/Makefile Mon Aug 1 19:52:35 2005
@@ -1,18 +1,7 @@
KERNEL_DIR=/usr/src/linux
TOPDIR=$(shell pwd)
-KERNEL_MAJOR_VERSION=$(shell head -n 1 $(KERNEL_DIR)/Makefile | sed 's/VERSION = \([0-9]*\)/\1/')
-KERNEL_MINOR_VERSION=$(shell head -n 2 $(KERNEL_DIR)/Makefile | tail -n 1 | sed 's/PATCHLEVEL = \([0-9]*\)/\1/')
-
-ifeq ($(KERNEL_MAJOR_VERSION),2)
- ifeq ($(KERNEL_MINOR_VERSION),6)
- KERNEL_VER_2_6=1
- else
- KERNEL_VER_2_6=0
- endif
-else
- KERNEL_VER_2_6=0
-endif
+KERNEL_VERSION := $(shell grep UTS_RELEASE $(KERNEL_DIR)/include/linux/version.h | sed -e 's/.*UTS_RELEASE "\([0-9]*\.[0-9]*\)\..*"/\1/')
export PLATFORM_X86_64 := $(shell uname -m | awk '{ if ($$0 ~ /x86[-_]64/) print "1"; else print "0"}')
@@ -22,7 +11,7 @@
all: copy_files
@make -C jnet
- @if [ $(KERNEL_VER_2_6) -eq 1 ] && [ $(PLATFORM_X86_64) -eq 1 ] ; then \
+ @if [ "$(KERNEL_VERSION)" = "2.6" ] && [ $(PLATFORM_X86_64) -eq 1 ] ; then \
echo "skipping nws_mc" ;\
else \
make -C nws_mc ;\
@@ -31,7 +20,7 @@
install: copy_files
make install -C jnet
- @if [ $(KERNEL_VER_2_6) -eq 1 ] && [ $(PLATFORM_X86_64) -eq 1 ] ; then \
+ @if [ "$(KERNEL_VERSION)" = "2.6" ] && [ $(PLATFORM_X86_64) -eq 1 ] ; then \
echo "skipping nws_mc" ;\
else \
make install -C nws_mc ;\
@@ -59,10 +48,10 @@
@rm -f nws_mc/Makefile
copy_files:
- @if [ $(KERNEL_VER_2_6) -eq 0 ] ; then \
+ @if [ "$(KERNEL_VERSION)" = "2.4" ] ; then \
cp jnet/makefile.2_4 jnet/Makefile ;\
cp nws_mc/makefile.2_4 nws_mc/Makefile ;\
- elif [ $(KERNEL_VER_2_6) -eq 1 ]; then \
+ elif [ "$(KERNEL_VERSION)" = "2.6" ]; then \
cp jnet/makefile.2_6 jnet/Makefile ;\
cp nws_mc/makefile.2_6 nws_mc/Makefile ;\
fi
================================================================
Index: nps/poci/Makefile
diff -u nps/poci/Makefile:1.1 nps/poci/Makefile:1.2
--- nps/poci/Makefile:1.1 Sat Jul 30 12:34:55 2005
+++ nps/poci/Makefile Mon Aug 1 19:52:35 2005
@@ -17,20 +17,18 @@
#
################################################################################
-KERNEL_MAJOR_VERSION ?= $(shell uname -r | sed 's/\([0-9]*\)\.[0-9]*\..*/\1/')
-KERNEL_MINOR_VERSION ?= $(shell uname -r | sed 's/[0-9]*\.\([0-9]*\)\..*/\1/')
+KERNEL_DIR=/usr/src/linux
+
+KERNEL_VERSION := $(shell grep UTS_RELEASE $(KERNEL_DIR)/include/linux/version.h | sed -e 's/.*UTS_RELEASE "\([0-9]*\.[0-9]*\)\..*"/\1/')
ARCH_VERSION ?= $(shell uname -m)
-ifeq ($(KERNEL_MAJOR_VERSION),2)
-ifeq ($(KERNEL_MINOR_VERSION),6)
-ifeq ($(ARCH_VERSION),x86_64)
+ifeq ($(KERNEL_VERSION),2.6)
MC_CFLAGS_EXTRA += -DLINUX_2_6_KERNEL=1
-POCI_CFLAGS_EXTRA += -DLINUX_2_6_KERNEL=1 -L /usr/lib -L /usr/lib64 -lpci
-endif
-endif
+POCI_CFLAGS_EXTRA += -DLINUX_2_6_KERNEL=1 -L/usr/lib -L/usr/lib64 -lpci
endif
-CFLAGS = -O2 -I ../common
+OPTFLAGS = -O2
+CFLAGS = $(OPTFLAGS) -I../common
.PHONY: all install uninstall postinstall preuninstall postuninstall clean
================================================================
---- CVS-web:
http://cvs.pld-linux.org/nps/Makefile?r1=1.4&r2=1.5&f=u
http://cvs.pld-linux.org/nps/poci/Makefile?r1=1.1&r2=1.2&f=u
More information about the pld-cvs-commit
mailing list