If KINCLUDE is not specified, it will be euqal to
/lib/modules/`uname -r`/build/include and as
KERNEL_VERSION = $(shell grep -oE "\"2\..*\""
$(KINCLUDE)/linux/version.h) the module will be built
for the kernel that is specified by KINCLUDE,
regardless of uname -r and therefor regardless of
running kernel.
It's a small patch against spca5xx-20050116:
--- spca5xx-20050116/Makefile 2005-01-17
01:00:53.000000000 +0330
+++ spca5xx-20050116.apakdel/Makefile 2005-02-05
11:09:19.999128016 +0330
@@ -45,7 +45,10 @@
DEFINES += -DCONFIG_USB_SPCA50X_MODULE=1 -DMODULE
-D__KERNEL__
DEFINES += -DVID_HARDWARE_SPCA50X=0xFF
-DSPCA50X_VERSION=\"$(VERSION)\"
-ifneq ($(shell uname -r | cut -d. -f1,2), 2.4)
+KINCLUDE = /lib/modules/`uname -r`/build/include
+KERNEL_VERSION = $(shell grep -oE "\"2\..*\""
$(KINCLUDE)/linux/version.h)
+
+ifneq ($(shell grep -oE "2\.."
$(KINCLUDE)/linux/version.h), 2.4)
ifneq ($(KERNELRELEASE),) # We were called by kbuild
CFLAGS += $(DEFINES)
@@ -54,7 +57,6 @@
else # We were called from command line
-KERNEL_VERSION = `uname -r`
KERNELDIR := /lib/modules/$(KERNEL_VERSION)/build
PWD := $(shell pwd)
MODULE_INSTALLDIR =
/lib/modules/$(KERNEL_VERSION)/kernel/drivers/usb/media/
@@ -89,9 +91,6 @@
# This makefile will build the spca50x driver module
external to the kernel
# source tree. It makes it easier to swap kernels.
-
-KERNEL_VERSION = `uname -r`
-
###
# Location of the header files (most importantly the
config files)
# for the kernel you want to build the module against.
the patch against spca5xx-20050116