[Spice-devel] [PATCH usbredir 7/8] Add a make install target for the kernel module.

Jeremy White jwhite at codeweavers.com
Wed Dec 9 14:16:07 PST 2015


Signed-off-by: Jeremy White <jwhite at codeweavers.com>
---
 kernel/Makefile | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/kernel/Makefile b/kernel/Makefile
index d14501e..dd67ac2 100644
--- a/kernel/Makefile
+++ b/kernel/Makefile
@@ -1,10 +1,21 @@
 includes := -I$(PWD)/../usbredirparser/
 
+MODULE_VERSION ?= $(shell uname -r)
+install_target := $(DESTDIR)/lib/modules/$(MODULE_VERSION)/kernel/drivers/usb/misc/
+
+INSTALL_PROGRAM ?= install
+
 obj-m += usbredir.o
 usbredir-y := main.o sysfs.o hub.o device.o urb.o redir.o tx.o rx.o includes.o
 
-modules:
-	make ccflags-y="${includes} -DDEBUG" -C /lib/modules/$(shell uname -r)/build/ M=$(PWD) modules
+usbredir.ko:
+	make ccflags-y="${includes} -DDEBUG" -C /lib/modules/$(MODULE_VERSION)/build/ M=$(PWD) modules
 
 clean:
-	make ccflags-y="${includes}" -C /lib/modules/$(shell uname -r)/build/ M=$(PWD) clean
+	make ccflags-y="${includes}" -C /lib/modules/$(MODULE_VERSION)/build/ M=$(PWD) clean
+
+install: usbredir.ko
+	mkdir -p $(install_target)
+	$(INSTALL_PROGRAM) usbredir.ko $(install_target)
+
+all: usbredir.ko
-- 
2.1.4



More information about the Spice-devel mailing list