Index: Makefile
===================================================================
RCS file: /usr/cvsroot/zaptel/Makefile,v
retrieving revision 1.44
diff -u -r1.44 Makefile
--- Makefile	2 May 2004 02:07:14 -0000	1.44
+++ Makefile	23 May 2004 21:32:24 -0000
@@ -32,6 +32,7 @@
 
 INSTALL_PREFIX=
 
+KERNELVER?=$(shell uname -r)
 BUILDVER=$(shell if uname -r | grep -q ^2.6; then echo "linux26"; else echo "linux24"; fi)
 MODCONF=$(shell if [ -d $(INSTALL_PREFIX)/etc/modprobe.d ]; then echo "$(INSTALL_PREFIX)/etc/modprobe.d/zaptel"; elif [ -d $(INSTALL_PREFIX)/etc/modutils ]; then echo "$(INSTALL_PREFIX)/etc/modutils/zaptel"; elif [ -f $(INSTALL_PREFIX)/etc/modprobe.conf ]; then echo "$(INSTALL_PREFIX)/etc/modprobe.conf"; elif [ -f $(INSTALL_PREFIX)/etc/modules.conf ]; then echo "$(INSTALL_PREFIX)/etc/modules.conf"; else echo $(INSTALL_PREFIX)/etc/conf.modules ; fi)
 
@@ -63,8 +64,8 @@
 
 linux26: 
 linux26: prereq $(BINS)
-	@if ! [ -d /usr/src/linux-2.6 ]; then echo "Link /usr/src/linux-2.6 to your kernel sources first!"; exit 1 ; fi
-	make -C /usr/src/linux-2.6 SUBDIRS=$(PWD) modules
+	@if ! [ -f /lib/modules/$(KERNELVER)/build/Makefile ]; then echo "kernel $(KERNELVER) lacking build tree!"; exit 1 ; fi
+	make -C /lib/modules/$(KERNELVER)/build SUBDIRS=$(PWD) modules
 
 obj-m := $(MODULESO)
 
@@ -245,21 +246,21 @@
 		install -m 755 sethdlc $(INSTALL_PREFIX)/sbin ; \
 	fi
 	if [ -f zttool ]; then install -m 755 zttool $(INSTALL_PREFIX)/sbin; fi
-	mkdir -p $(INSTALL_PREFIX)/lib/modules/`uname -r`/misc
+	mkdir -p $(INSTALL_PREFIX)/lib/modules/$(KERNELVER)/misc
 
 	if [ -f zaptel.ko ]; then \
 		for x in $(MODULESKO); do \
-			install -m 644 $$x $(INSTALL_PREFIX)/lib/modules/`uname -r`/misc ; \
+			install -m 644 $$x $(INSTALL_PREFIX)/lib/modules/$(KERNELVER)/misc ; \
 		done; \
 		if ! [ -f wcfxsusb.ko ]; then \
-			rm -f $(INSTALL_PREFIX)/lib/modules/`uname -r`/misc/wcfxsusb.o; \
+			rm -f $(INSTALL_PREFIX)/lib/modules/$(KERNELVER)/misc/wcfxsusb.o; \
 		fi; \
 	else \
 		for x in $(MODULESO); do \
-			install -m 644 $$x $(INSTALL_PREFIX)/lib/modules/`uname -r`/misc ; \
+			install -m 644 $$x $(INSTALL_PREFIX)/lib/modules/$(KERNELVER)/misc ; \
 		done; \
 		if ! [ -f wcfxsusb.o ]; then \
-			rm -f $(INSTALL_PREFIX)/lib/modules/`uname -r`/misc/wcfxsusb.ko; \
+			rm -f $(INSTALL_PREFIX)/lib/modules/$(KERNELVER)/misc/wcfxsusb.ko; \
 		fi; \
 	fi
 
