diff --git a/example-sysctl/Makefile b/example-sysctl/Makefile index dfd0d65d..67dce95e 100644 --- a/example-sysctl/Makefile +++ b/example-sysctl/Makefile @@ -1,9 +1,10 @@ obj-m := examplesysctl.o examplesysctl-objs := target/x86_64-linux-kernel-module/debug/libexample_sysctl.a EXTRA_LDFLAGS += --entry=init_module +KDIR ?= /lib/modules/$(shell uname -r)/build all: - $(MAKE) -C /lib/modules/$(shell uname -r)/build M=$(CURDIR) + $(MAKE) -C $(KDIR) M=$(CURDIR) clean: - $(MAKE) -C /lib/modules/$(shell uname -r)/build M=$(CURDIR) clean + $(MAKE) -C $(KDIR) M=$(CURDIR) clean diff --git a/hello-world/Makefile b/hello-world/Makefile index ff54b9e9..fccc18c3 100644 --- a/hello-world/Makefile +++ b/hello-world/Makefile @@ -1,9 +1,10 @@ obj-m := helloworld.o helloworld-objs := target/x86_64-linux-kernel-module/debug/libhello_world.a EXTRA_LDFLAGS += --entry=init_module +KDIR ?= /lib/modules/$(shell uname -r)/build all: - $(MAKE) -C /lib/modules/$(shell uname -r)/build M=$(CURDIR) + $(MAKE) -C $(KDIR) M=$(CURDIR) clean: - $(MAKE) -C /lib/modules/$(shell uname -r)/build M=$(CURDIR) clean + $(MAKE) -C $(KDIR) M=$(CURDIR) clean diff --git a/static-filesystem/Makefile b/static-filesystem/Makefile index 67052baa..7b5f28c1 100644 --- a/static-filesystem/Makefile +++ b/static-filesystem/Makefile @@ -1,9 +1,10 @@ obj-m := staticfilesystem.o staticfilesystem-objs := target/x86_64-linux-kernel-module/debug/libstatic_filesystem.a EXTRA_LDFLAGS += --entry=init_module +KDIR ?= /lib/modules/$(shell uname -r)/build all: - $(MAKE) -C /lib/modules/$(shell uname -r)/build M=$(CURDIR) + $(MAKE) -C $(KDIR) M=$(CURDIR) clean: - $(MAKE) -C /lib/modules/$(shell uname -r)/build M=$(CURDIR) clean + $(MAKE) -C $(KDIR) M=$(CURDIR) clean diff --git a/tests/Makefile b/tests/Makefile index 5184e4d7..acfd9592 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -1,9 +1,10 @@ obj-m := testmodule.o testmodule-objs := $(TEST_LIBRARY) EXTRA_LDFLAGS += --entry=init_module +KDIR ?= /lib/modules/$(shell uname -r)/build all: - $(MAKE) -C /lib/modules/$(shell uname -r)/build M=$(CURDIR) + $(MAKE) -C $(KDIR) M=$(CURDIR) clean: - $(MAKE) -C /lib/modules/$(shell uname -r)/build M=$(CURDIR) clean + $(MAKE) -C $(KDIR) M=$(CURDIR) clean