summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2013-02-17 11:05:11 -0800
committerBrian Behlendorf <[email protected]>2013-03-06 15:46:40 -0800
commitd09f98a9a688905a06a4bd2a92752bebe0f28e63 (patch)
tree7cde203cbc8f229f5df37b98d97501f915c3da7a
parentfd2b4aa71a53f3565522675de97b872c104383f4 (diff)
Add KMODDIR to install target
Provide a mechanism to control the directory name the modules are installed in. The kernel privdes INSTALL_MOD_DIR for this but it was hardcoded to be 'addon/zfs'. Add a KMODDIR variable which can be passed to 'make install' to override the default directory name. While we're here change the default from 'addon/zfs' to 'extra' which is the kernel.org default. Signed-off-by: Brian Behlendorf <[email protected]>
-rw-r--r--module/Makefile.in21
1 files changed, 13 insertions, 8 deletions
diff --git a/module/Makefile.in b/module/Makefile.in
index c69b8a355..4c6d38168 100644
--- a/module/Makefile.in
+++ b/module/Makefile.in
@@ -5,6 +5,8 @@ subdir-m += zcommon
subdir-m += zfs
subdir-m += zpios
+INSTALL_MOD_DIR ?= extra
+
ZFS_MODULE_CFLAGS += -include @SPL_OBJ@/spl_config.h
ZFS_MODULE_CFLAGS += -include @abs_top_builddir@/zfs_config.h
ZFS_MODULE_CFLAGS += -I@abs_top_srcdir@/include -I@SPL@/include -I@SPL@
@@ -39,22 +41,25 @@ clean:
modules_install:
@# Install the kernel modules
- $(MAKE) -C @LINUX_OBJ@ SUBDIRS=`pwd` \
- INSTALL_MOD_PATH=$(DESTDIR) \
- INSTALL_MOD_DIR=addon/zfs $@
+ $(MAKE) -C @LINUX_OBJ@ SUBDIRS=`pwd` $@ \
+ INSTALL_MOD_PATH=$(DESTDIR)$(INSTALL_MOD_PATH) \
+ INSTALL_MOD_DIR=$(INSTALL_MOD_DIR)
@# Remove extraneous build products when packaging
- if [ -n "$(DESTDIR)" ]; then \
- find $(DESTDIR)/lib/modules/@LINUX_VERSION@ \
- -name 'modules.*' | xargs $(RM); \
+ kmoddir=$(DESTDIR)$(INSTALL_MOD_PATH)/lib/modules/@LINUX_VERSION@; \
+ if [ -n $$kmoddir ]; then \
+ find $$kmoddir -name 'modules.*' | xargs $(RM); \
fi
- sysmap=$(DESTDIR)/boot/System.map-@LINUX_VERSION@; \
+ sysmap=$(DESTDIR)$(INSTALL_MOD_PATH)/boot/System.map-@LINUX_VERSION@; \
if [ -f $$sysmap ]; then \
depmod -ae -F $$sysmap @LINUX_VERSION@; \
fi
modules_uninstall:
@# Uninstall the kernel modules
- $(RM) -R $(DESTDIR)/lib/modules/@LINUX_VERSION@/addon/zfs
+ kmoddir=$(DESTDIR)$(INSTALL_MOD_PATH)/lib/modules/@LINUX_VERSION@
+ list='$(subdir-m)'; for subdir in $$list; do \
+ $(RM) -R $$kmoddir/$(INSTALL_MOD_DIR)/$$subdir; \
+ done
distdir: