From c016fa2d21d28156a7945824e5ad64e506a4148e Mon Sep 17 00:00:00 2001 From: russell Date: Fri, 4 Nov 2005 05:03:38 +0000 Subject: make it easier to build against kernels other than the currently running one (issue #5446) git-svn-id: http://svn.digium.com/svn/zaptel/branches/v1-0@807 5390a7c7-147a-4af0-8ec9-7488f05a26cb --- Makefile | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 5175fb6..940baec 100755 --- a/Makefile +++ b/Makefile @@ -13,6 +13,8 @@ BASEADDR=0xd0000 # (assuming He's running Linux -- which we all know He must). # HOSTCC=gcc +# If you want to build for a kernel other than the current kernel,set KVERS +KVERS?=`uname -r` KINCLUDES=$(shell if [ -d /usr/src/linux-2.4/include ]; then echo /usr/src/linux-2.4/include ; else echo /usr/src/linux/include ; fi) CFLAGS+=-I. -O4 -g -Wall -DBUILDING_TONEZONE #-DTONEZONE_DRIVER @@ -38,7 +40,7 @@ INSTALL_PREFIX= CONFIG_FILE=$(INSTALL_PREFIX)/etc/zaptel.conf CFLAGS+=-DZAPTEL_CONFIG=\"$(CONFIG_FILE)\" -BUILDVER=$(shell if uname -r | grep -q ^2.6; then echo "linux26"; else echo "linux24"; fi) +BUILDVER=$(shell if echo -n $(KVERS) | grep -q ^2.6; then echo "linux26"; else echo "linux24"; fi) MODCONF=$(shell if [ -d $(ROOT_PREFIX)/etc/modprobe.d ]; then echo "$(ROOT_PREFIX)/etc/modprobe.d/zaptel"; elif [ -d $(ROOT_PREFIX)/etc/modutils ]; then echo "$(ROOT_PREFIX)/etc/modutils/zaptel"; elif [ -f $(ROOT_PREFIX)/etc/modprobe.conf ]; then echo "$(ROOT_PREFIX)/etc/modprobe.conf"; elif [ -f $(ROOT_PREFIX)/etc/modules.conf ]; then echo "$(ROOT_PREFIX)/etc/modules.conf"; else echo $(ROOT_PREFIX)/etc/conf.modules ; fi) ifeq (${BUILDVER},linux24) @@ -71,7 +73,7 @@ BINS=ztcfg torisatool makefw ztmonitor ztspeed $(ZTTOOL) zttest PRIMARY=torisa #PRIMARY=wcfxo PWD=$(shell pwd) -KERNEL_SOURCE?=/lib/modules/`uname -r`/build +KERNEL_SOURCE?=/lib/modules/$(KVERS)/build all: $(BUILDVER) $(LIBTONEZONE) @@ -272,17 +274,17 @@ install: all devices if [ -f zttool ]; then install -D -m 755 zttool $(INSTALL_PREFIX)/sbin/zttool; fi if [ -f zaptel.ko ]; then \ for x in $(MODULESKO) ztdummy.ko; do \ - install -D -m 644 $$x $(INSTALL_PREFIX)/lib/modules/`uname -r`/misc/$$x ; \ + install -D -m 644 $$x $(INSTALL_PREFIX)/lib/modules/$(KVERS)/misc/$$x ; \ done; \ if ! [ -f wcfxsusb.ko ]; then \ - rm -f $(INSTALL_PREFIX)/lib/modules/`uname -r`/misc/wcfxsusb.o; \ + rm -f $(INSTALL_PREFIX)/lib/modules/$(KVERS)/misc/wcfxsusb.o; \ fi; \ else \ for x in $(MODULESO); do \ - install -D -m 644 $$x $(INSTALL_PREFIX)/lib/modules/`uname -r`/misc/$$x ; \ + install -D -m 644 $$x $(INSTALL_PREFIX)/lib/modules/$(KVERS)/misc/$$x ; \ done; \ if ! [ -f wcfxsusb.o ]; then \ - rm -f $(INSTALL_PREFIX)/lib/modules/`uname -r`/misc/wcfxsusb.ko; \ + rm -f $(INSTALL_PREFIX)/lib/modules/$(KVERS)/misc/wcfxsusb.ko; \ fi; \ fi install -D -m 755 $(LIBTONEZONE) $(INSTALL_PREFIX)/usr/lib/$(LIBTONEZONE) @@ -324,7 +326,7 @@ install: all devices if [ -d /etc/modutils ]; then \ /sbin/update-modules ; \ fi - [ `id -u` = 0 ] && /sbin/depmod -a || : + [ `id -u` = 0 ] && /sbin/depmod -a $(KVERS) || : [ -f $(CONFIG_FILE) ] || install -D -m 644 zaptel.conf.sample $(CONFIG_FILE) config: -- cgit v1.2.3