3 INSTALL_MOD_DIR ?
= extra
5 SUBDIR_TARGETS
= icp lua
8 distclean maintainer-clean
: clean
9 install: modules_install
10 uninstall: modules_uninstall
13 .PHONY
: all distclean maintainer-clean
install uninstall check distdir \
14 modules modules-Linux modules-FreeBSD modules-unknown \
15 clean clean-Linux clean-FreeBSD \
16 modules_install modules_install-Linux modules_install-FreeBSD \
17 modules_uninstall modules_uninstall-Linux modules_uninstall-FreeBSD
19 # Filter out options that FreeBSD make doesn't understand
22 $(filter-out --%,$(firstword $(MFLAGS
))) \
23 $(filter -I
%,$(MFLAGS
)) \
24 $(filter -j
%,$(MFLAGS
)); \
26 while getopts
:deiI
:j
:knqrstw flag
; do \
29 :) if
[ $$OPTARG = "j" ]; then \
30 ncpus
=$$(sysctl
-n kern.smp.cpus
2>/dev
/null ||
:); \
31 if
[ -n
"$$ncpus" ]; then fmakeflags
="$$fmakeflags -j$$ncpus"; fi
; \
33 d
) fmakeflags
="$$fmakeflags -dA";; \
34 *) fmakeflags
="$$fmakeflags -$$flag$$OPTARG";; \
39 FMAKEFLAGS
= -C @abs_srcdir@
-f Makefile.bsd
$(shell $(getflags
))
41 ifneq (@abs_srcdir@
,@abs_builddir@
)
42 FMAKEFLAGS
+= MAKEOBJDIR
=@abs_builddir@
44 FMAKE
= env
-u MAKEFLAGS make
$(FMAKEFLAGS
)
47 list
='$(SUBDIR_TARGETS)'; for targetdir in
$$list; do \
48 $(MAKE
) -C
$$targetdir; \
50 $(MAKE
) -C @LINUX_OBJ@ M
=`pwd` @KERNEL_MAKE@ CONFIG_ZFS
=m modules
58 modules
: modules-@ac_system@
61 @
# Only cleanup the kernel build directories when CONFIG_KERNEL
62 @
# is defined. This indicates that kernel modules should be built.
63 @CONFIG_KERNEL_TRUE@
$(MAKE
) -C @LINUX_OBJ@ M
=`pwd` @KERNEL_MAKE@
clean
65 if
[ -f @LINUX_SYMBOLS@
]; then
$(RM
) @LINUX_SYMBOLS@
; fi
66 if
[ -f Module.markers
]; then
$(RM
) Module.markers
; fi
68 find .
-name
'*.ur-safe' -type f
-print | xargs
$(RM
)
73 clean: clean-@ac_system@
75 modules_install-Linux
:
76 @
# Install the kernel modules
77 $(MAKE
) -C @LINUX_OBJ@ M
=`pwd` modules_install \
78 INSTALL_MOD_PATH
=$(DESTDIR
)$(INSTALL_MOD_PATH
) \
79 INSTALL_MOD_DIR
=$(INSTALL_MOD_DIR
) \
80 KERNELRELEASE
=@LINUX_VERSION@
81 @
# Remove extraneous build products when packaging
82 kmoddir
=$(DESTDIR
)$(INSTALL_MOD_PATH
)/lib
/modules
/@LINUX_VERSION@
; \
83 if
[ -n
"$(DESTDIR)" ]; then \
84 find
$$kmoddir -name
'modules.*' | xargs
$(RM
); \
86 sysmap
=$(DESTDIR
)$(INSTALL_MOD_PATH
)/boot
/System.map-@LINUX_VERSION@
; \
87 if
[ -f
$$sysmap ]; then \
88 depmod
-ae
-F
$$sysmap @LINUX_VERSION@
; \
91 modules_install-FreeBSD
:
92 @
# Install the kernel modules
95 modules_install
: modules_install-@ac_system@
97 modules_uninstall-Linux
:
98 @
# Uninstall the kernel modules
99 kmoddir
=$(DESTDIR
)$(INSTALL_MOD_PATH
)/lib
/modules
/@LINUX_VERSION@ \
100 for objdir in
$(ZFS_MODULES
); do \
101 $(RM
) -R
$$kmoddir/$(INSTALL_MOD_DIR
)/$$objdir; \
104 modules_uninstall-FreeBSD
:
107 modules_uninstall
: modules_uninstall-@ac_system@
110 (cd @
srcdir@
&& find
$(ZFS_MODULES
) os
-name
'*.[chS]') | \
111 while read path
; do \
112 mkdir
-p
$$distdir/$${path
%/*}; \
113 cp @
srcdir@
/$$path $$distdir/$$path; \
115 cp @
srcdir@
/Makefile.bsd
$$distdir/Makefile.bsd