mirror of
https://github.com/SCST-project/scst.git
synced 2026-09-19 22:44:24 +00:00
Makefiles: calculate KVER properly
When deriving the kernel version (KVER) from KDIR, the file
$(KDIR)/include/config/kernel.release should be preferred over
'make kernelversion'.
For example, the Ubuntu 3.2.0-23-generic kernel has a kernel.release
file containing '3.2.0-23-generic', but 'make kernelversion' returns
3.2.14. Since the modules are stored under /lib/modules/3.2.0-23-generic,
the value in kernel.release is the correct one to use.
Also:
- Evaluate KVER only once
- All depmod commands must include KVER
Signed-off-by: Steven J. Magnani <steve@digidescorp.com>
[bvanassche: Split long lines / removed trailing whitespace]
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5286 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
+10
-4
@@ -15,13 +15,19 @@ SUBDIRS := $(shell pwd)
|
||||
|
||||
ifeq ($(KVER),)
|
||||
ifeq ($(KDIR),)
|
||||
KVER = $(shell uname -r)
|
||||
KDIR ?= /lib/modules/$(KVER)/build
|
||||
KVER := $(shell uname -r)
|
||||
KDIR := /lib/modules/$(KVER)/build
|
||||
else
|
||||
KVER = $$KERNELRELEASE
|
||||
ifeq ($(KERNELRELEASE),)
|
||||
KVER := $(strip $(shell \
|
||||
cat $(KDIR)/include/config/kernel.release 2>/dev/null || \
|
||||
make -s -C $(KDIR) kernelversion))
|
||||
else
|
||||
KVER := $(KERNELRELEASE)
|
||||
endif
|
||||
endif
|
||||
else
|
||||
KDIR ?= /lib/modules/$(KVER)/build
|
||||
KDIR := /lib/modules/$(KVER)/build
|
||||
endif
|
||||
|
||||
# Set variable $(2) to value $(3) in file $(1).
|
||||
|
||||
Reference in New Issue
Block a user