[PATCH] Makefile: rework kernel version logic

Mikkmar mikkmar at airmail.cc
Wed Aug 21 05:52:50 CEST 2019


>From 9a959c2a542d3c7f584e26dca2673dd7dd1ef8fb Mon Sep 17 00:00:00 2001
From: Mikk <mikkmar at airmail.cc>
Date: Wed, 21 Aug 2019 06:48:02 +0300
Subject: [PATCH] Makefile: rework kernel version logic

This makes depmod actually work when building/installing the module for
a kernel other than the currently running one

Signed-off-by: Mikk <mikkmar at airmail.cc>
---
 src/Makefile | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/Makefile b/src/Makefile
index 24b2ba0..d0d6c4d 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -2,7 +2,8 @@
 #
 # Copyright (C) 2015-2019 Jason A. Donenfeld <Jason at zx2c4.com>. All
Rights Reserved.

-KERNELDIR ?= /lib/modules/$(shell uname -r)/build
+KVER ?= $(shell uname -r)
+KERNELDIR ?= /lib/modules/$(KVER)/build
 PREFIX ?= /usr
 DESTDIR ?=
 SRCDIR ?= $(PREFIX)/src
@@ -45,7 +46,7 @@ clean:

 module-install:
 	@$(MAKE) -C $(KERNELDIR) M=$(PWD) modules_install
-	$(DEPMOD) -a
+	$(DEPMOD) -a $(KVER)

 install: module-install tools-install

-- 
2.23.0



More information about the WireGuard mailing list