From 3c8f5f7bfaad2ca955c600ea1ee8d4df5b4d8a27 Mon Sep 17 00:00:00 2001 From: Chris J Arges Date: Mon, 8 Feb 2016 10:46:06 -0600 Subject: [PATCH] Makefile: determine kernel release in Makefile Don't assume we are building for the current kernel. In addition print out a proper package necessary for building the module. Signed-off-by: Chris J Arges --- kmod/core/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kmod/core/Makefile b/kmod/core/Makefile index 53ad8e4..3a01339 100644 --- a/kmod/core/Makefile +++ b/kmod/core/Makefile @@ -1,9 +1,10 @@ # make rules KPATCH_BUILD ?= /lib/modules/$(shell uname -r)/build +KERNELRELEASE := $(lastword $(subst /, , $(dir $(KPATCH_BUILD)))) THISDIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))) ifeq ($(wildcard $(KPATCH_BUILD)),) -$(error $(KPATCH_BUILD) doesn\'t exist. Try installing the kernel-devel-$(shell uname -r) RPM or linux-image-$(shell uname -r)-dbg DEB.) +$(error $(KPATCH_BUILD) doesn\'t exist. Try installing the kernel-devel-$(KERNELRELEASE) RPM or linux-headers-$(KERNELRELEASE) DEB.) endif KPATCH_MAKE = $(MAKE) -C $(KPATCH_BUILD) M=$(THISDIR)