]> git.proxmox.com Git - mirror_zfs.git/blame - module/Makefile.in
ZTS: Minimize udev_wait in zvol_misc tests
[mirror_zfs.git] / module / Makefile.in
CommitLineData
71504277 1include Kbuild
c9c0d073 2
d09f98a9
BB
3INSTALL_MOD_DIR ?= extra
4
10b3c7f5 5SUBDIR_TARGETS = icp lua zstd
0b04990a 6
bced7e3a
MM
7all: modules
8distclean maintainer-clean: clean
9install: modules_install
10uninstall: modules_uninstall
11check:
12
0b032548
AS
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 \
0e6c493f
BB
17 modules_uninstall modules_uninstall-Linux modules_uninstall-FreeBSD \
18 cppcheck cppcheck-Linux cppcheck-FreeBSD
0b032548 19
ba74de88
RM
20# For FreeBSD, use debug options from ./configure if not overridden.
21export WITH_DEBUG ?= @WITH_DEBUG@
22export WITH_INVARIANTS ?= @WITH_INVARIANTS@
23
33982eb2
AS
24# Filter out options that FreeBSD make doesn't understand
25getflags = ( \
26set -- \
27 $(filter-out --%,$(firstword $(MFLAGS))) \
28 $(filter -I%,$(MFLAGS)) \
29 $(filter -j%,$(MFLAGS)); \
30fmakeflags=""; \
31while getopts :deiI:j:knqrstw flag; do \
32 case $$flag in \
33 \?) :;; \
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; \
37 fi;; \
38 d) fmakeflags="$$fmakeflags -dA";; \
39 *) fmakeflags="$$fmakeflags -$$flag$$OPTARG";; \
40 esac; \
41done; \
42echo $$fmakeflags \
43)
44FMAKEFLAGS = -C @abs_srcdir@ -f Makefile.bsd $(shell $(getflags))
45
46ifneq (@abs_srcdir@,@abs_builddir@)
47FMAKEFLAGS += MAKEOBJDIR=@abs_builddir@
48endif
ba74de88 49
33982eb2
AS
50FMAKE = env -u MAKEFLAGS make $(FMAKEFLAGS)
51
bced7e3a 52modules-Linux:
0b04990a
TC
53 list='$(SUBDIR_TARGETS)'; for targetdir in $$list; do \
54 $(MAKE) -C $$targetdir; \
55 done
bced7e3a
MM
56 $(MAKE) -C @LINUX_OBJ@ M=`pwd` @KERNEL_MAKE@ CONFIG_ZFS=m modules
57
9f0a21e6 58modules-FreeBSD:
33982eb2 59 +$(FMAKE)
9f0a21e6 60
bced7e3a
MM
61modules-unknown:
62 @true
63
64modules: modules-@ac_system@
c9c0d073 65
bced7e3a 66clean-Linux:
d433c206
BB
67 @# Only cleanup the kernel build directories when CONFIG_KERNEL
68 @# is defined. This indicates that kernel modules should be built.
bced7e3a 69@CONFIG_KERNEL_TRUE@ $(MAKE) -C @LINUX_OBJ@ M=`pwd` @KERNEL_MAKE@ clean
d433c206 70
c9c0d073
BB
71 if [ -f @LINUX_SYMBOLS@ ]; then $(RM) @LINUX_SYMBOLS@; fi
72 if [ -f Module.markers ]; then $(RM) Module.markers; fi
73
b669ab83
BB
74 find . -name '*.ur-safe' -type f -print | xargs $(RM)
75
9f0a21e6 76clean-FreeBSD:
33982eb2 77 +$(FMAKE) clean
9f0a21e6 78
bced7e3a
MM
79clean: clean-@ac_system@
80
81modules_install-Linux:
6283f55e 82 @# Install the kernel modules
bced7e3a 83 $(MAKE) -C @LINUX_OBJ@ M=`pwd` modules_install \
d09f98a9 84 INSTALL_MOD_PATH=$(DESTDIR)$(INSTALL_MOD_PATH) \
bb9d808c
AP
85 INSTALL_MOD_DIR=$(INSTALL_MOD_DIR) \
86 KERNELRELEASE=@LINUX_VERSION@
fe0ed8f9 87 @# Remove extraneous build products when packaging
d09f98a9 88 kmoddir=$(DESTDIR)$(INSTALL_MOD_PATH)/lib/modules/@LINUX_VERSION@; \
b0fe1ade 89 if [ -n "$(DESTDIR)" ]; then \
d09f98a9 90 find $$kmoddir -name 'modules.*' | xargs $(RM); \
fe0ed8f9 91 fi
d09f98a9 92 sysmap=$(DESTDIR)$(INSTALL_MOD_PATH)/boot/System.map-@LINUX_VERSION@; \
c9c0d073
BB
93 if [ -f $$sysmap ]; then \
94 depmod -ae -F $$sysmap @LINUX_VERSION@; \
95 fi
c9c0d073 96
9f0a21e6
MM
97modules_install-FreeBSD:
98 @# Install the kernel modules
33982eb2 99 +$(FMAKE) install
9f0a21e6 100
bced7e3a
MM
101modules_install: modules_install-@ac_system@
102
103modules_uninstall-Linux:
6283f55e 104 @# Uninstall the kernel modules
07f5d4d6 105 kmoddir=$(DESTDIR)$(INSTALL_MOD_PATH)/lib/modules/@LINUX_VERSION@; \
7c902a51 106 for objdir in $(ZFS_MODULES); do \
ff4b68ee 107 $(RM) -R $$kmoddir/$(INSTALL_MOD_DIR)/$$objdir; \
d09f98a9 108 done
c9c0d073 109
9f0a21e6
MM
110modules_uninstall-FreeBSD:
111 @false
112
bced7e3a
MM
113modules_uninstall: modules_uninstall-@ac_system@
114
0e6c493f
BB
115cppcheck-Linux:
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
128
129cppcheck-FreeBSD:
130 @true
131
132cppcheck: cppcheck-@ac_system@
133
c9c0d073 134distdir:
7c902a51
AS
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; \
139 done; \
140 cp @srcdir@/Makefile.bsd $$distdir/Makefile.bsd