summaryrefslogtreecommitdiff
path: root/linux/Makefile
diff options
context:
space:
mode:
authorDimitri Staessens <[email protected]>2017-12-15 18:13:30 +0100
committerDimitri Staessens <[email protected]>2017-12-15 18:25:26 +0100
commit9e419e39cf84f6bc8f0590f319cb6059a73dc660 (patch)
treeb4741c252bdd2b0d8fcc7df3e2867d76127eb74d /linux/Makefile
parentd1a1059d748955ed93a8e87c437c7eae1258293c (diff)
downloadraptor-9e419e39cf84f6bc8f0590f319cb6059a73dc660.tar.gz
raptor-9e419e39cf84f6bc8f0590f319cb6059a73dc660.zip
linux: Add install/uninstall targets for make
This adds targets for the Makefile so that the module can be installed with "make install" and uninstalled using "make uninstall" (with root privileges).
Diffstat (limited to 'linux/Makefile')
-rw-r--r--linux/Makefile17
1 files changed, 15 insertions, 2 deletions
diff --git a/linux/Makefile b/linux/Makefile
index 9c7b2b9..86a92fc 100644
--- a/linux/Makefile
+++ b/linux/Makefile
@@ -1,7 +1,20 @@
obj-m += raptor.o
+KERNELVER ?= $(shell uname -r)
+KERNELDIR ?= /lib/modules/$(KERNELVER)
+PWD := $(shell pwd)
+INSTALL_MOD_DIR ?= extra
+
all:
- make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
+ make -C $(KERNELDIR)/build M=$(PWD) modules
clean:
- make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
+ make -C $(KERNELDIR)/build M=$(PWD) clean
+
+install:
+ make -C $(KERNELDIR)/build M=$(PWD) modules_install
+ /sbin/depmod -a $(KERNELVER)
+
+uninstall:
+ rm $(KERNELDIR)/$(INSTALL_MOD_DIR)/raptor.ko.gz
+ /sbin/depmod -a $(KERNELVER)