]> git.proxmox.com Git - mirror_spl.git/blobdiff - module/Makefile.in
Fix CPU hotplug
[mirror_spl.git] / module / Makefile.in
index caa403228985fd48335b415bb1a2329cc6a2a868..41c10101ed26f6104fcbf8649d2b25d6517c53af 100644 (file)
@@ -1,34 +1,49 @@
 subdir-m += spl
 subdir-m += splat
 
-INSTALL=/usr/bin/install
+INSTALL_MOD_DIR ?= extra
+
+SPL_MODULE_CFLAGS  = -I@abs_top_srcdir@/include
+SPL_MODULE_CFLAGS += -include @abs_top_builddir@/spl_config.h
+export SPL_MODULE_CFLAGS
 
 modules:
-       $(MAKE) -C @LINUX_OBJ@ SUBDIRS=`pwd` @KERNELMAKE_PARAMS@ $@
+       $(MAKE) -C @LINUX_OBJ@ SUBDIRS=`pwd` @KERNELMAKE_PARAMS@ CONFIG_SPL=m $@
 
 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 @LINUX_SYMBOLS@ ]; then $(RM) @LINUX_SYMBOLS@; fi
        if [ -f Module.markers ]; then $(RM) Module.markers; fi
 
 modules_install:
-       # Install the kernel modules
-       $(MAKE) -C @LINUX_OBJ@ SUBDIRS=`pwd` \
-               INSTALL_MOD_PATH=$(DESTDIR) \
-               INSTALL_MOD_DIR=addon/spl $@
-       find ${DESTDIR}/lib/modules/ -name 'modules.*' | xargs ${RM}
-       sysmap=${DESTDIR}/boot/System.map-@LINUX_VERSION@; \
+       @# Install the kernel modules
+       $(MAKE) -C @LINUX_OBJ@ SUBDIRS=`pwd` $@ \
+               INSTALL_MOD_PATH=$(DESTDIR)$(INSTALL_MOD_PATH) \
+               INSTALL_MOD_DIR=$(INSTALL_MOD_DIR) \
+               KERNELRELEASE=@LINUX_VERSION@
+       @# Remove extraneous build products when packaging
+       kmoddir=$(DESTDIR)$(INSTALL_MOD_PATH)/lib/modules/@LINUX_VERSION@; \
+       if [ -n $$kmoddir ]; then \
+               find $$kmoddir -name 'modules.*' | xargs $(RM); \
+       fi
+       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/spl
+       @# Uninstall the kernel modules
+       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:
        list='$(subdir-m)'; for subdir in $$list; do \
-               (find $$subdir -name '*.c' -o -name '*.h' | \
+               (find @top_srcdir@/module/$$subdir -name '*.c' -o -name '*.h' |\
                 xargs /bin/cp -t $$distdir/$$subdir); \
        done