|
Line 0
Link Here
|
|
|
1 |
Index: ndiswrapper-1.2/driver/Makefile |
| 2 |
=================================================================== |
| 3 |
--- ndiswrapper-1.2.orig/driver/Makefile |
| 4 |
+++ ndiswrapper-1.2/driver/Makefile |
| 5 |
@@ -8,6 +8,10 @@ DISTFILES=divdi3.c hal.c iw_ndis.c iw_nd |
| 6 |
|
| 7 |
KVERS ?= $(shell uname -r) |
| 8 |
KSRC ?= /lib/modules/$(KVERS)/build |
| 9 |
+#Try to guess |
| 10 |
+KOBJ ?= $(KBUILD_OUTPUT) |
| 11 |
+#Fallback |
| 12 |
+KOBJ ?= $(KSRC) |
| 13 |
|
| 14 |
KPSUB := $(shell echo $(KVERS) | sed -e 's/\([^\.]*\)\.\([^\.]*\)\..*/\1\2/') |
| 15 |
|
| 16 |
@@ -16,11 +20,11 @@ INST_DIR := $(DESTDIR)/lib/modules/$(KVE |
| 17 |
|
| 18 |
SRC_DIR=$(shell pwd) |
| 19 |
|
| 20 |
--include $(KSRC)/.config |
| 21 |
+-include $(KOBJ)/.config |
| 22 |
|
| 23 |
-CFLAGS += $(shell [ -f $(KSRC)/include/linux/modversions.h ] && \ |
| 24 |
+CFLAGS += $(shell [ -f $(KOBJ)/include/linux/modversions.h ] && \ |
| 25 |
echo -DEXPORT_SYMTAB -DMODVERSIONS \ |
| 26 |
- -include $(KSRC)/include/linux/modversions.h) |
| 27 |
+ -include $(KOBJ)/include/linux/modversions.h) |
| 28 |
|
| 29 |
ifdef DEBUG |
| 30 |
CFLAGS += -DDEBUG=$(DEBUG) -g -DDEBUG_TIMER |
| 31 |
@@ -152,10 +156,11 @@ gen_exports: ndis_exports.h hal_exports. |
| 32 |
misc_funcs_exports.h usb_exports.h wrapper_exports.h |
| 33 |
|
| 34 |
prereq_check: |
| 35 |
- @ if [ ! -f $(KSRC)/include/linux/version.h ]; then \ |
| 36 |
- echo "Can't find kernel sources in $(KSRC);"; \ |
| 37 |
+ @ if [ ! -f $(KOBJ)/include/linux/version.h ]; then \ |
| 38 |
+ echo "Can't find compiled kernel sources in $(KOBJ);"; \ |
| 39 |
echo " give the path to kernel sources with KSRC=<path>\ |
| 40 |
- argument to make";\ |
| 41 |
+ argument to make. " \ |
| 42 |
+ echo "If using KBUILD_OUTPUT, pass the used value in environment"; \ |
| 43 |
exit 1;\ |
| 44 |
fi |
| 45 |
|
| 46 |
@@ -184,8 +189,12 @@ obj-m := ndiswrapper.o |
| 47 |
|
| 48 |
ndiswrapper-objs := $(OBJS) |
| 49 |
|
| 50 |
+KBUILD_OUT_OPT= |
| 51 |
+ifneq ($(KOBJ),) |
| 52 |
+KBUILD_OUT_OPT="O=$(KOBJ)" |
| 53 |
+endif |
| 54 |
default: |
| 55 |
- $(MAKE) -C $(KSRC) SUBDIRS=$(SRC_DIR) \ |
| 56 |
+ $(MAKE) $(KBUILD_OUT_OPT) -C $(KSRC) SUBDIRS=$(SRC_DIR) \ |
| 57 |
NDISWRAPPER_VERSION=$(NDISWRAPPER_VERSION) \ |
| 58 |
EXTRA_VERSION=$(EXTRA_VERSION) modules |
| 59 |
|
| 60 |
@@ -193,8 +202,8 @@ endif |
| 61 |
|
| 62 |
stack_check: |
| 63 |
@ if [ "x$(CONFIG_X86_64)" = "x" -a $(KPSUB) -eq 26 ]; then \ |
| 64 |
- if grep -q CONFIG_4KSTACKS $(KSRC)/.config; then \ |
| 65 |
- if grep -q "CONFIG_4KSTACKS=y" $(KSRC)/.config; then \ |
| 66 |
+ if grep -q CONFIG_4KSTACKS $(KOBJ)/.config; then \ |
| 67 |
+ if grep -q "CONFIG_4KSTACKS=y" $(KOBJ)/.config; then \ |
| 68 |
echo; echo; \ |
| 69 |
echo "*** WARNING: "\ |
| 70 |
"Kernel is compiled with 4K stack size option"\ |