mirror of
https://github.com/SCST-project/scst.git
synced 2026-08-20 14:16:31 +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:
+23
-15
@@ -26,19 +26,6 @@
|
||||
# - install and uninstall must be made as root
|
||||
#
|
||||
|
||||
ifndef PREFIX
|
||||
PREFIX=/usr/local
|
||||
endif
|
||||
|
||||
ifeq ($(KVER),)
|
||||
ifeq ($(KDIR),)
|
||||
KVER = $(shell uname -r)
|
||||
KDIR := /lib/modules/$(KVER)/build
|
||||
endif
|
||||
else
|
||||
KDIR := /lib/modules/$(KVER)/build
|
||||
endif
|
||||
|
||||
export PWD := $(shell pwd)
|
||||
export CONFIG_FCST := m
|
||||
|
||||
@@ -55,11 +42,30 @@ EXTRA_CFLAGS += -I$(SCST_INC_DIR) $(FCSTFLAGS$(BUILDMODE))
|
||||
|
||||
MODULE_NAME = fcst
|
||||
|
||||
INSTALL_DIR := /lib/modules/$(KVER)/extra
|
||||
|
||||
ifneq ($(KERNELRELEASE),)
|
||||
include $(SUBDIRS)/Makefile_in-tree
|
||||
else
|
||||
######### BEGIN OUT-OF-TREE RULES #########
|
||||
|
||||
ifndef PREFIX
|
||||
PREFIX=/usr/local
|
||||
endif
|
||||
|
||||
ifeq ($(KVER),)
|
||||
ifeq ($(KDIR),)
|
||||
KVER := $(shell uname -r)
|
||||
KDIR := /lib/modules/$(KVER)/build
|
||||
else
|
||||
KVER := $(strip $(shell \
|
||||
cat $(KDIR)/include/config/kernel.release 2>/dev/null || \
|
||||
make -s -C $(KDIR) kernelversion))
|
||||
endif
|
||||
else
|
||||
KDIR := /lib/modules/$(KVER)/build
|
||||
endif
|
||||
|
||||
INSTALL_DIR := /lib/modules/$(KVER)/extra
|
||||
|
||||
SCST_INC_DIR := $(shell if [ -e "$$PWD/../scst" ]; \
|
||||
then echo "$$PWD/../scst/include"; \
|
||||
else echo "$(PREFIX)/include/scst"; fi)
|
||||
@@ -102,6 +108,8 @@ endif
|
||||
uninstall:
|
||||
rm -f $(INSTALL_DIR)/$(MODULE_NAME).ko
|
||||
-/sbin/depmod -a $(KVER)
|
||||
|
||||
########## END OUT-OF-TREE RULES ##########
|
||||
endif
|
||||
|
||||
clean:
|
||||
|
||||
Reference in New Issue
Block a user