3 INSTALL_MOD_DIR ?
= extra
5 SUBDIR_TARGETS
= icp lua zstd
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 \
18 cppcheck cppcheck-Linux cppcheck-FreeBSD
20 # For FreeBSD, use debug options from ./configure if not overridden.
21 export WITH_DEBUG ?
= @WITH_DEBUG@
22 export WITH_INVARIANTS ?
= @WITH_INVARIANTS@
24 # Filter out options that FreeBSD make doesn't understand
27 $(filter-out --%,$(firstword $(MFLAGS
))) \
28 $(filter -I
%,$(MFLAGS
)) \
29 $(filter -j
%,$(MFLAGS
)); \
31 while getopts
:deiI
:j
:knqrstw flag
; do \
34 :) if
[ $$OPTARG = "j" ]; then \
35 ncpus
=$$(sysctl
-n kern.smp.cpus
2>/dev
/null ||
:); \
36 if
[ -n
"$$ncpus" ]; then fmakeflags
="$$fmakeflags -j$$ncpus"; fi
; \
38 d
) fmakeflags
="$$fmakeflags -dA";; \
39 *) fmakeflags
="$$fmakeflags -$$flag$$OPTARG";; \
44 FMAKEFLAGS
= -C @abs_srcdir@
-f Makefile.bsd
$(shell $(getflags
))
46 ifneq (@abs_srcdir@
,@abs_builddir@
)
47 FMAKEFLAGS
+= MAKEOBJDIR
=@abs_builddir@
50 FMAKE
= env
-u MAKEFLAGS make
$(FMAKEFLAGS
)
53 list
='$(SUBDIR_TARGETS)'; for targetdir in
$$list; do \
54 $(MAKE
) -C
$$targetdir; \
56 $(MAKE
) -C @LINUX_OBJ@ M
=`pwd` @KERNEL_MAKE@ CONFIG_ZFS
=m modules
64 modules
: modules-@ac_system@
67 @
# Only cleanup the kernel build directories when CONFIG_KERNEL
68 @
# is defined. This indicates that kernel modules should be built.
69 @CONFIG_KERNEL_TRUE@
$(MAKE
) -C @LINUX_OBJ@ M
=`pwd` @KERNEL_MAKE@
clean
71 if
[ -f @LINUX_SYMBOLS@
]; then
$(RM
) @LINUX_SYMBOLS@
; fi
72 if
[ -f Module.markers
]; then
$(RM
) Module.markers
; fi
74 find .
-name
'*.ur-safe' -type f
-print | xargs
$(RM
)
79 clean: clean-@ac_system@
81 modules_install-Linux
:
82 @
# Install the kernel modules
83 $(MAKE
) -C @LINUX_OBJ@ M
=`pwd` modules_install \
84 INSTALL_MOD_PATH
=$(DESTDIR
)$(INSTALL_MOD_PATH
) \
85 INSTALL_MOD_DIR
=$(INSTALL_MOD_DIR
) \
86 KERNELRELEASE
=@LINUX_VERSION@
87 @
# Remove extraneous build products when packaging
88 kmoddir
=$(DESTDIR
)$(INSTALL_MOD_PATH
)/lib
/modules
/@LINUX_VERSION@
; \
89 if
[ -n
"$(DESTDIR)" ]; then \
90 find
$$kmoddir -name
'modules.*' | xargs
$(RM
); \
92 sysmap
=$(DESTDIR
)$(INSTALL_MOD_PATH
)/boot
/System.map-@LINUX_VERSION@
; \
93 if
[ -f
$$sysmap ]; then \
94 depmod
-ae
-F
$$sysmap @LINUX_VERSION@
; \
97 modules_install-FreeBSD
:
98 @
# Install the kernel modules
101 modules_install
: modules_install-@ac_system@
103 modules_uninstall-Linux
:
104 @
# Uninstall the kernel modules
105 kmoddir
=$(DESTDIR
)$(INSTALL_MOD_PATH
)/lib
/modules
/@LINUX_VERSION@
; \
106 for objdir in
$(ZFS_MODULES
); do \
107 $(RM
) -R
$$kmoddir/$(INSTALL_MOD_DIR
)/$$objdir; \
110 modules_uninstall-FreeBSD
:
113 modules_uninstall
: modules_uninstall-@ac_system@
116 @CPPCHECK@
-j@CPU_COUNT@
--std
=c99
--quiet
--force --error-exitcode
=2 \
117 --inline-suppr
--suppress
=noValidConfiguration \
118 --enable
=warning
,information
-D_KERNEL \
119 --include=@LINUX_OBJ@
/include/generated
/autoconf.h \
120 --include=@top_srcdir@
/zfs_config.h \
121 --config-exclude
=@LINUX_OBJ@
/include \
122 -I @LINUX_OBJ@
/include \
123 -I @top_srcdir@
/include/os
/linux
/kernel \
124 -I @top_srcdir@
/include/os
/linux
/spl \
125 -I @top_srcdir@
/include/os
/linux
/zfs \
126 -I @top_srcdir@
/include \
127 avl icp lua nvpair spl unicode zcommon zfs zstd os
/linux
132 cppcheck
: cppcheck-@ac_system@
135 (cd @
srcdir@
&& find
$(ZFS_MODULES
) os
-name
'*.[chS]') | \
136 while read path
; do \
137 mkdir
-p
$$distdir/$${path
%/*}; \
138 cp @
srcdir@
/$$path $$distdir/$$path; \
140 cp @
srcdir@
/Makefile.bsd
$$distdir/Makefile.bsd