Add build system
[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
7 modules:
8         # Make the exported SPL symbols available to these modules.
9         cp @SPL_OBJ@/@SPL_SYMBOLS@ .
10         $(MAKE) -C @LINUX_OBJ@ SUBDIRS=`pwd` @KERNELMAKE_PARAMS@ $@
11
12 clean:
13         $(MAKE) -C @LINUX_OBJ@ SUBDIRS=`pwd` @KERNELMAKE_PARAMS@ $@
14         if [ -f @SPL_SYMBOLS@ ]; then $(RM) @SPL_SYMBOLS@; fi
15         if [ -f @LINUX_SYMBOLS@ ]; then $(RM) @LINUX_SYMBOLS@; fi
16         if [ -f Module.markers ]; then $(RM) Module.markers; fi
17
18 modules_install:
19         # Install the kernel modules
20         $(MAKE) -C @LINUX_OBJ@ SUBDIRS=`pwd` \
21                 INSTALL_MOD_PATH=$(DESTDIR) \
22                 INSTALL_MOD_DIR=addon/zfs $@
23         find ${DESTDIR}/lib/modules/ -name 'modules.*' | xargs ${RM}
24         sysmap=${DESTDIR}/boot/System.map-@LINUX_VERSION@; \
25         if [ -f $$sysmap ]; then \
26                 depmod -ae -F $$sysmap @LINUX_VERSION@; \
27         fi
28         # Install the required headers in to the kernel source
29         destname=zfs-@ZFS_META_VERSION@/@LINUX_VERSION@; \
30         instdest=$(DESTDIR)/usr/src/$$destname; \
31         (find . -mindepth 3 -name '*.h' | xargs -Ihdr sh -c \
32          "DEST=hdr && install -D hdr $$instdest/\$${DEST#*/*/*/}") || exit 1
33
34 modules_uninstall:
35         # Uninstall the kernel modules
36         $(RM) -R ${DESTDIR}/lib/modules/@LINUX_VERSION@/addon/zfs
37         # Uninstall the required headers from the kernel source
38         destname=zfs-@ZFS_META_VERSION@/@LINUX_VERSION@; \
39         instdest=$(DESTDIR)/usr/src/$$destname; \
40         $(RM) -R $$instdest
41
42 distdir:
43         distfiles=`find . -name '*.c' -o -name '*.h'`; \
44         for distfile in $$distfiles; do \
45                 distpath=`dirname $$distdir/$$distfile`; \
46                 (/bin/mkdir -p $$distpath && \
47                  /bin/cp $$distfile $$distdir/$$distfile) || exit 1; \
48         done
49
50 distclean maintainer-clean: clean
51 install: modules_install
52 uninstall: modules_uninstall
53 all: modules
54 check: