summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--module/Makefile.in6
1 files changed, 5 insertions, 1 deletions
diff --git a/module/Makefile.in b/module/Makefile.in
index d9f73c287..50cbb5891 100644
--- a/module/Makefile.in
+++ b/module/Makefile.in
@@ -37,7 +37,11 @@ modules_install:
$(MAKE) -C @LINUX_OBJ@ SUBDIRS=`pwd` \
INSTALL_MOD_PATH=$(DESTDIR) \
INSTALL_MOD_DIR=addon/zfs $@
- find $(DESTDIR)/lib/modules/ -name 'modules.*' | xargs $(RM)
+ @# Remove extraneous build products when packaging
+ if [ -n "$(DESTDIR)" ]; then \
+ find $(DESTDIR)/lib/modules/@LINUX_VERSION@ \
+ -name 'modules.*' | xargs $(RM); \
+ fi
sysmap=$(DESTDIR)/boot/System.map-@LINUX_VERSION@; \
if [ -f $$sysmap ]; then \
depmod -ae -F $$sysmap @LINUX_VERSION@; \