mirror of
https://github.com/SCST-project/scst.git
synced 2026-08-21 06:36:27 +00:00
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
49 lines
1.2 KiB
Makefile
49 lines
1.2 KiB
Makefile
#
|
|
# Makefile for ibmvstgt.ko.
|
|
#
|
|
|
|
SCST_DIR := $(shell pwd)/../scst/src
|
|
SUBDIRS := $(shell pwd)
|
|
|
|
ifeq ($(KVER),)
|
|
ifeq ($(KDIR),)
|
|
KVER := $(shell uname -r)
|
|
KDIR := /lib/modules/$(KVER)/build
|
|
else
|
|
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
|
|
endif
|
|
|
|
# The file Modules.symvers has been renamed in the 2.6.18 kernel to
|
|
# Module.symvers. Find out which name to use by looking in $(KDIR).
|
|
MODULE_SYMVERS:=$(shell if [ -e $(KDIR)/Module.symvers ]; then \
|
|
echo Module.symvers; else echo Modules.symvers; fi)
|
|
|
|
|
|
all: src/$(MODULE_SYMVERS)
|
|
$(MAKE) -C $(KDIR) SUBDIRS=$(shell pwd)/src modules
|
|
|
|
install: all src/ibmvstgt.ko
|
|
$(MAKE) -C $(KDIR) SUBDIRS=$(shell pwd)/src modules_install
|
|
|
|
src/Module.symvers src/Modules.symvers: $(SCST_DIR)/$(MODULE_SYMVERS)
|
|
cp $< $@;
|
|
|
|
clean:
|
|
$(MAKE) -C $(KDIR) SUBDIRS=$(shell pwd)/src clean
|
|
rm -f src/Modules.symvers src/Module.symvers src/Module.markers \
|
|
src/modules.order
|
|
|
|
extraclean: clean
|
|
rm -f *.orig *.rej
|
|
|
|
.PHONY: all install clean extraclean
|