c69b8a35560e401b4392f344f65cf1210874a116
[zfs.git] / module / Makefile.in
1 subdir-m += avl
2 subdir-m += nvpair
3 subdir-m += unicode
4 subdir-m += zcommon
5 subdir-m += zfs
6 subdir-m += zpios
7
8 ZFS_MODULE_CFLAGS += -include @SPL_OBJ@/spl_config.h
9 ZFS_MODULE_CFLAGS += -include @abs_top_builddir@/zfs_config.h
10 ZFS_MODULE_CFLAGS += -I@abs_top_srcdir@/include -I@SPL@/include -I@SPL@
11 export ZFS_MODULE_CFLAGS
12
13 modules:
14         @# Make the exported SPL symbols available to these modules.
15         @# They may be in the root of SPL_OBJ when building against
16         @# installed devel headers, or they may be in the module
17         @# subdirectory when building against the spl source tree.
18         @if [ -f @SPL_OBJ@/@SPL_SYMBOLS@ ]; then \
19                 /bin/cp @SPL_OBJ@/@SPL_SYMBOLS@ .; \
20         elif [ -f @SPL_OBJ@/module/@SPL_SYMBOLS@ ]; then \
21                 /bin/cp @SPL_OBJ@/module/@SPL_SYMBOLS@ .; \
22         else \
23                 echo -e "\n" \
24                 "*** Missing spl symbols ensure you have built the spl:\n" \
25                 "*** - @SPL_OBJ@/@SPL_SYMBOLS@, or\n" \
26                 "*** - @SPL_OBJ@/module/@SPL_SYMBOLS@\n"; \
27                 exit 1; \
28         fi
29         $(MAKE) -C @LINUX_OBJ@ SUBDIRS=`pwd` @KERNELMAKE_PARAMS@ CONFIG_ZFS=m $@
30
31 clean:
32         @# Only cleanup the kernel build directories when CONFIG_KERNEL
33         @# is defined.  This indicates that kernel modules should be built.
34 @CONFIG_KERNEL_TRUE@    $(MAKE) -C @LINUX_OBJ@ SUBDIRS=`pwd` @KERNELMAKE_PARAMS@ $@
35
36         if [ -f @SPL_SYMBOLS@ ]; then $(RM) @SPL_SYMBOLS@; fi
37         if [ -f @LINUX_SYMBOLS@ ]; then $(RM) @LINUX_SYMBOLS@; fi
38         if [ -f Module.markers ]; then $(RM) Module.markers; fi
39
40 modules_install:
41         @# Install the kernel modules
42         $(MAKE) -C @LINUX_OBJ@ SUBDIRS=`pwd` \
43                 INSTALL_MOD_PATH=$(DESTDIR) \
44                 INSTALL_MOD_DIR=addon/zfs $@
45         @# Remove extraneous build products when packaging
46         if [ -n "$(DESTDIR)" ]; then \
47                 find $(DESTDIR)/lib/modules/@LINUX_VERSION@ \
48                         -name 'modules.*' | xargs $(RM); \
49         fi
50         sysmap=$(DESTDIR)/boot/System.map-@LINUX_VERSION@; \
51         if [ -f $$sysmap ]; then \
52                 depmod -ae -F $$sysmap @LINUX_VERSION@; \
53         fi
54
55 modules_uninstall:
56         @# Uninstall the kernel modules
57         $(RM) -R $(DESTDIR)/lib/modules/@LINUX_VERSION@/addon/zfs
58
59 distdir:
60
61 distclean maintainer-clean: clean
62 install: modules_install
63 uninstall: modules_uninstall
64 all: modules
65 check: