$(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@; \