Fix incompatible pointer type warning
[zfs.git] / module / Makefile.in
index 78e4814..50cbb58 100644 (file)
@@ -24,7 +24,10 @@ modules:
        $(MAKE) -C @LINUX_OBJ@ SUBDIRS=`pwd` @KERNELMAKE_PARAMS@ $@
 
 clean:
-       $(MAKE) -C @LINUX_OBJ@ SUBDIRS=`pwd` @KERNELMAKE_PARAMS@ $@
+       @# Only cleanup the kernel build directories when CONFIG_KERNEL
+       @# is defined.  This indicates that kernel modules should be built.
+@CONFIG_KERNEL_TRUE@   $(MAKE) -C @LINUX_OBJ@ SUBDIRS=`pwd` @KERNELMAKE_PARAMS@ $@
+
        if [ -f @SPL_SYMBOLS@ ]; then $(RM) @SPL_SYMBOLS@; fi
        if [ -f @LINUX_SYMBOLS@ ]; then $(RM) @LINUX_SYMBOLS@; fi
        if [ -f Module.markers ]; then $(RM) Module.markers; fi
@@ -34,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@; \