9 INSTALL_MOD_DIR ?= extra
11 ZFS_MODULE_CFLAGS += -include @SPL_OBJ@/spl_config.h
12 ZFS_MODULE_CFLAGS += -include @abs_top_builddir@/zfs_config.h
13 ZFS_MODULE_CFLAGS += -I@abs_top_srcdir@/include -I@SPL@/include -I@SPL@
14 export ZFS_MODULE_CFLAGS
19 @# Make the exported SPL symbols available to these modules.
20 @# They may be in the root of SPL_OBJ when building against
21 @# installed devel headers, or they may be in the module
22 @# subdirectory when building against the spl source tree.
23 @if [ -f @SPL_OBJ@/@SPL_SYMBOLS@ ]; then \
24 cp @SPL_OBJ@/@SPL_SYMBOLS@ .; \
25 elif [ -f @SPL_OBJ@/module/@SPL_SYMBOLS@ ]; then \
26 cp @SPL_OBJ@/module/@SPL_SYMBOLS@ .; \
29 "*** Missing spl symbols ensure you have built the spl:\n" \
30 "*** - @SPL_OBJ@/@SPL_SYMBOLS@, or\n" \
31 "*** - @SPL_OBJ@/module/@SPL_SYMBOLS@\n"; \
34 list='$(SUBDIR_TARGETS)'; for targetdir in $$list; do \
35 $(MAKE) -C $$targetdir; \
37 $(MAKE) -C @LINUX_OBJ@ SUBDIRS=`pwd` @KERNELMAKE_PARAMS@ CONFIG_ZFS=m $@
40 @# Only cleanup the kernel build directories when CONFIG_KERNEL
41 @# is defined. This indicates that kernel modules should be built.
42 @CONFIG_KERNEL_TRUE@ $(MAKE) -C @LINUX_OBJ@ SUBDIRS=`pwd` @KERNELMAKE_PARAMS@ $@
44 if [ -f @SPL_SYMBOLS@ ]; then $(RM) @SPL_SYMBOLS@; fi
45 if [ -f @LINUX_SYMBOLS@ ]; then $(RM) @LINUX_SYMBOLS@; fi
46 if [ -f Module.markers ]; then $(RM) Module.markers; fi
49 @# Install the kernel modules
50 $(MAKE) -C @LINUX_OBJ@ SUBDIRS=`pwd` $@ \
51 INSTALL_MOD_PATH=$(DESTDIR)$(INSTALL_MOD_PATH) \
52 INSTALL_MOD_DIR=$(INSTALL_MOD_DIR) \
53 KERNELRELEASE=@LINUX_VERSION@
54 @# Remove extraneous build products when packaging
55 kmoddir=$(DESTDIR)$(INSTALL_MOD_PATH)/lib/modules/@LINUX_VERSION@; \
56 if [ -n "$(DESTDIR)" ]; then \
57 find $$kmoddir -name 'modules.*' | xargs $(RM); \
59 sysmap=$(DESTDIR)$(INSTALL_MOD_PATH)/boot/System.map-@LINUX_VERSION@; \
60 if [ -f $$sysmap ]; then \
61 depmod -ae -F $$sysmap @LINUX_VERSION@; \
65 @# Uninstall the kernel modules
66 kmoddir=$(DESTDIR)$(INSTALL_MOD_PATH)/lib/modules/@LINUX_VERSION@
67 list='$(subdir-m)'; for subdir in $$list; do \
68 $(RM) -R $$kmoddir/$(INSTALL_MOD_DIR)/$$subdir; \
72 list='$(subdir-m)'; for subdir in $$list; do \
73 (cd @top_srcdir@/module && find $$subdir -name '*.c' -o -name '*.h' -o -name '*.S' |\
74 xargs cp --parents -t $$distdir); \
77 distclean maintainer-clean: clean
78 install: modules_install
79 uninstall: modules_uninstall