From: Brian Behlendorf Date: Sun, 17 Feb 2013 19:05:11 +0000 (-0800) Subject: Add KMODDIR to install target X-Git-Url: https://git.camperquake.de/gitweb.cgi?a=commitdiff_plain;h=d09f98a9a688905a06a4bd2a92752bebe0f28e63;p=zfs.git 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 --- diff --git a/module/Makefile.in b/module/Makefile.in index c69b8a3..4c6d381 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: