aboutsummaryrefslogtreecommitdiff
path: root/driver/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'driver/Makefile')
-rw-r--r--driver/Makefile14
1 files changed, 13 insertions, 1 deletions
diff --git a/driver/Makefile b/driver/Makefile
index 7de7424..f9cb359 100644
--- a/driver/Makefile
+++ b/driver/Makefile
@@ -9,9 +9,17 @@ obj-m += lork.o
lork-y += main.o
lork-y += platform.o
-all:
+# utility
+ifneq ($(shell id -u),0)
+AS_ROOT := sudo -n
+endif
+.PHONY: FORCE
+
+lork.ko: FORCE
$(MAKE) -C $(KERNEL) M=$(PWD) modules
+all: lork.ko FORCE
+
# the generated compile_commands.json needs to be edited to point to the kernel
# folder as working directory because the include paths are relative
compile_commands.json:
@@ -19,3 +27,7 @@ compile_commands.json:
jq --arg dir $(KERNEL) '.[].directory = $$dir' $@.tmp > $@
$(RM) $@.tmp
+poke: lork.ko FORCE
+ $(AS_ROOT) insmod $<
+ $(AS_ROOT) rmmod $<
+