[Asterisk-cvs] zaptel Makefile,1.52.2.13,1.52.2.14

russell russell
Fri Nov 4 00:11:56 CST 2005


Update of /usr/cvsroot/zaptel
In directory mongoose.digium.com:/tmp/cvs-serv4356

Modified Files:
      Tag: v1-0
	Makefile 
Log Message:
make it easier to build against kernels other than the currently running one
(issue #5446)


Index: Makefile
===================================================================
RCS file: /usr/cvsroot/zaptel/Makefile,v
retrieving revision 1.52.2.13
retrieving revision 1.52.2.14
diff -u -d -r1.52.2.13 -r1.52.2.14
--- Makefile	8 Aug 2005 18:06:02 -0000	1.52.2.13
+++ Makefile	4 Nov 2005 05:03:38 -0000	1.52.2.14
@@ -13,6 +13,8 @@
 # (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 @@
 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 @@
 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 @@
 	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 @@
 	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:




More information about the svn-commits mailing list