From 9e419e39cf84f6bc8f0590f319cb6059a73dc660 Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Fri, 15 Dec 2017 18:13:30 +0100 Subject: 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). --- linux/Makefile | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'linux') 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) -- cgit v1.2.3