|
1 | 1 | ifndef TP_MODULES |
2 | 2 | # This part runs as a normal, top-level Makefile: |
3 | 3 | X:=$(shell false) |
4 | | -KVER := $(shell uname -r) |
5 | | -KBASE := /lib/modules/$(KVER) |
6 | | -KSRC := $(KBASE)/source |
7 | | -KBUILD := $(KBASE)/build |
8 | | -MOD_DIR := $(KBASE)/kernel |
| 4 | +KVER ?= $(shell uname -r) |
| 5 | +KBASE ?= /lib/modules/$(KVER) |
| 6 | +KSRC ?= $(KBASE)/source |
| 7 | +KBUILD ?= $(KBASE)/build |
| 8 | +MOD_DIR ?= $(KBASE)/kernel |
9 | 9 | PWD := $(shell pwd) |
10 | 10 | IDIR := include/linux |
11 | 11 | TP_DIR := drivers/platform/x86 |
|
25 | 25 | THINKPAD_EC_PARAM := |
26 | 26 | endif |
27 | 27 |
|
| 28 | +ifneq ($(KERNELRELEASE),) |
| 29 | + obj-m := $(TP_MODULES) |
| 30 | +else |
| 31 | +endif |
| 32 | + |
28 | 33 | DEBUG := 0 |
29 | 34 |
|
30 | 35 | .PHONY: default clean modules load unload install patch check_hdaps mk-hdaps.diff \ |
@@ -78,13 +83,13 @@ ifeq ($(HDAPS),1) |
78 | 83 | rm -f $(MOD_DIR)/extra/hdaps.ko |
79 | 84 | endif |
80 | 85 | $(MAKE) -C $(KBUILD) M=$(PWD) O=$(KBUILD) modules_install |
81 | | - depmod -a |
| 86 | + depmod $(KVER) |
82 | 87 |
|
83 | 88 |
|
84 | 89 | ##################################################################### |
85 | 90 | # Generate a stand-alone kernel patch |
86 | 91 |
|
87 | | -TP_VER := ${shell sed -ne 's/^\#define TP_VERSION \"\(.*\)\"/\1/gp' tp_smapi.c} |
| 92 | +TP_VER := 0.41 |
88 | 93 | ORG := a |
89 | 94 | NEW := b |
90 | 95 | PATCH := tp_smapi-$(TP_VER)-for-$(KVER).patch |
@@ -149,6 +154,8 @@ check-ver: |
149 | 154 | set-version: check-ver |
150 | 155 | perl -i -pe 's/^(tp_smapi version ).*/$${1}$(VER)/' README |
151 | 156 | perl -i -pe 's/^(#define TP_VERSION ").*/$${1}$(VER)"/' thinkpad_ec.c tp_smapi.c |
| 157 | + perl -i -pe 's/^(TP_VER := ).*/$${1}$(VER)/' Makefile |
| 158 | + perl -i -pe 's/^(PACKAGE_VERSION=").*/$${1}$(VER)"/' dkms.conf |
152 | 159 |
|
153 | 160 | create-tgz: check-ver |
154 | 161 | git archive --format=tar --prefix=tp_smapi-$(VER)/ HEAD | gzip -c > $(TGZ) |
|
0 commit comments