tp-smapi (0.40-9) 99_Makefile-for-Debian.patch

Summary

 Makefile |   37 ++++++++++++++++++++++---------------
 1 file changed, 22 insertions(+), 15 deletions(-)

    
download this patch

Patch contents

Author: Evgeni Golov <sargentd@die-welt.net>
Description: make the Makefile work better with debian kernel-package
Index: tp-smapi/Makefile
===================================================================
--- tp-smapi.orig/Makefile	2009-03-26 16:46:02.000000000 +0100
+++ tp-smapi/Makefile	2009-03-26 17:44:46.000000000 +0100
@@ -1,12 +1,13 @@
 ifndef TP_MODULES
 # This part runs as a normal, top-level Makefile:
 X:=$(shell false)
-KVER        := $(shell uname -r)
+PWD         := $(shell pwd)
+#KVER        := $(shell uname -r)
 KBASE       := /lib/modules/$(KVER)
-KSRC        := $(KBASE)/source
-KBUILD      := $(KBASE)/build
+KSRC        ?= $(PWD)
+#KBUILD      := $(KBASE)/build
+KBUILD      := $(KSRC)
 MOD_DIR     := $(KBASE)/kernel
-PWD         := $(shell pwd)
 IDIR        := include/linux
 TP_DIR      := drivers/misc
 TP_MODULES  := thinkpad_ec.o tp_smapi.o
@@ -25,18 +26,24 @@
 THINKPAD_EC_PARAM := 
 endif
 
+ifneq ($(KERNELRELEASE),)
+	TP_MODULES  += hdaps.o
+	obj-m  := $(TP_MODULES)
+else
+endif
 DEBUG := 0
 
-ifneq ($(shell [ -f $(KBUILD)/include/linux/aio_abi.h ] && echo 1),1)
-$(warning Building tp_smapi requires Linux kernel 2.6.19 or newer, and matching kernel headers.)
-$(warning You may need to override the following Make variables:)
-$(warning .   KVER=$(KVER))
-$(warning .   KBUILD=$(KBUILD))
-$(warning .   MOD_DIR=$(MOD_DIR))
-$(warning For "make patch", you may also need the full kernel sources, and may need to override:)
-$(warning .   KSRC=$(KSRC))
-$(error Missing kernel headers)
-endif
+# We have 2.6.26 in stable - don't care for 2.6.19
+#ifneq ($(shell [ -f $(KBUILD)/include/linux/aio_abi.h ] && echo 1),1)
+#$(warning Building tp_smapi requires Linux kernel 2.6.19 or newer, and matching kernel headers.)
+#$(warning You may need to override the following Make variables:)
+#$(warning .   KVER=$(KVER))
+#$(warning .   KBUILD=$(KBUILD))
+#$(warning .   MOD_DIR=$(MOD_DIR))
+#$(warning For "make patch", you may also need the full kernel sources, and may need to override:)
+#$(warning .   KSRC=$(KSRC))
+#$(error Missing kernel headers)
+#endif
 
 .PHONY: default clean modules load unload install patch check_hdaps mk-hdaps.diff
 export TP_MODULES
@@ -94,7 +101,7 @@
 #####################################################################
 # Generate a stand-alone kernel patch
 
-TP_VER := ${shell sed -ne 's/^\#define TP_VERSION \"\(.*\)\"/\1/gp' tp_smapi.c}
+#TP_VER := ${shell sed -ne 's/^\#define TP_VERSION \"\(.*\)\"/\1/gp' tp_smapi.c}
 ORG    := a
 NEW    := b
 PATCH  := tp_smapi-$(TP_VER)-for-$(KVER).patch