]> git.proxmox.com Git - mirror_zfs.git/blame - module/Makefile.in
Extend import_progress kstat with a notes field
[mirror_zfs.git] / module / Makefile.in
CommitLineData
71504277 1include Kbuild
c9c0d073 2
d09f98a9 3INSTALL_MOD_DIR ?= extra
ed3a3bdb 4INSTALL_MOD_PATH ?= $(DESTDIR)
d09f98a9 5
bced7e3a
MM
6all: modules
7distclean maintainer-clean: clean
c8970f52
AZ
8install: modules_install data_install
9uninstall: modules_uninstall data_uninstall
bced7e3a
MM
10check:
11
0b032548
AS
12.PHONY: all distclean maintainer-clean install uninstall check distdir \
13 modules modules-Linux modules-FreeBSD modules-unknown \
14 clean clean-Linux clean-FreeBSD \
15 modules_install modules_install-Linux modules_install-FreeBSD \
c8970f52 16 data_install data_install-Linux data_install-FreeBSD \
0e6c493f 17 modules_uninstall modules_uninstall-Linux modules_uninstall-FreeBSD \
c8970f52 18 data_uninstall data_uninstall-Linux data_uninstall-FreeBSD \
0e6c493f 19 cppcheck cppcheck-Linux cppcheck-FreeBSD
0b032548 20
ba74de88
RM
21# For FreeBSD, use debug options from ./configure if not overridden.
22export WITH_DEBUG ?= @WITH_DEBUG@
23export WITH_INVARIANTS ?= @WITH_INVARIANTS@
24
33982eb2
AS
25# Filter out options that FreeBSD make doesn't understand
26getflags = ( \
27set -- \
28 $(filter-out --%,$(firstword $(MFLAGS))) \
29 $(filter -I%,$(MFLAGS)) \
30 $(filter -j%,$(MFLAGS)); \
31fmakeflags=""; \
32while getopts :deiI:j:knqrstw flag; do \
33 case $$flag in \
34 \?) :;; \
35 :) if [ $$OPTARG = "j" ]; then \
36 ncpus=$$(sysctl -n kern.smp.cpus 2>/dev/null || :); \
37 if [ -n "$$ncpus" ]; then fmakeflags="$$fmakeflags -j$$ncpus"; fi; \
38 fi;; \
39 d) fmakeflags="$$fmakeflags -dA";; \
40 *) fmakeflags="$$fmakeflags -$$flag$$OPTARG";; \
41 esac; \
42done; \
43echo $$fmakeflags \
44)
45FMAKEFLAGS = -C @abs_srcdir@ -f Makefile.bsd $(shell $(getflags))
46
47ifneq (@abs_srcdir@,@abs_builddir@)
48FMAKEFLAGS += MAKEOBJDIR=@abs_builddir@
49endif
ba74de88 50
33982eb2
AS
51FMAKE = env -u MAKEFLAGS make $(FMAKEFLAGS)
52
bced7e3a 53modules-Linux:
ad9e7676
AZ
54 mkdir -p $(sort $(dir $(spl-objs) $(spl-)))
55 mkdir -p $(sort $(dir $(zfs-objs) $(zfs-)))
b66140c6
PL
56 $(MAKE) -C @LINUX_OBJ@ $(if @KERNEL_CC@,CC=@KERNEL_CC@) \
57 $(if @KERNEL_LD@,LD=@KERNEL_LD@) $(if @KERNEL_LLVM@,LLVM=@KERNEL_LLVM@) \
58 M="$$PWD" @KERNEL_MAKE@ CONFIG_ZFS=m modules
bced7e3a 59
9f0a21e6 60modules-FreeBSD:
33982eb2 61 +$(FMAKE)
9f0a21e6 62
bced7e3a
MM
63modules-unknown:
64 @true
65
66modules: modules-@ac_system@
c9c0d073 67
bced7e3a 68clean-Linux:
d433c206
BB
69 @# Only cleanup the kernel build directories when CONFIG_KERNEL
70 @# is defined. This indicates that kernel modules should be built.
ccc421ec 71@CONFIG_KERNEL_TRUE@ $(MAKE) -C @LINUX_OBJ@ M="$$PWD" @KERNEL_MAKE@ clean
d433c206 72
c5d8cd63
AZ
73 $(RM) @LINUX_SYMBOLS@ Module.markers
74 find . -name '*.ur-safe' -type f -delete
b669ab83 75
9f0a21e6 76clean-FreeBSD:
33982eb2 77 +$(FMAKE) clean
9f0a21e6 78
bced7e3a
MM
79clean: clean-@ac_system@
80
9b80d9e6
AZ
81.PHONY: modules_uninstall-Linux-legacy
82modules_uninstall-Linux-legacy:
83 $(RM) -r $(addprefix $(KMODDIR)/$(INSTALL_MOD_DIR)/,spl/ avl/ icp/ lua/ nvpair/ unicode/ zcommon/ zfs/ zstd/)
84
ad9e7676 85KMODDIR := $(INSTALL_MOD_PATH)/lib/modules/@LINUX_VERSION@
9b80d9e6 86modules_install-Linux: modules_uninstall-Linux-legacy
6283f55e 87 @# Install the kernel modules
ccc421ec 88 $(MAKE) -C @LINUX_OBJ@ M="$$PWD" modules_install \
ed3a3bdb 89 INSTALL_MOD_PATH=$(INSTALL_MOD_PATH) \
bb9d808c
AP
90 INSTALL_MOD_DIR=$(INSTALL_MOD_DIR) \
91 KERNELRELEASE=@LINUX_VERSION@
fe0ed8f9 92 @# Remove extraneous build products when packaging
b0fe1ade 93 if [ -n "$(DESTDIR)" ]; then \
ad9e7676 94 find $(KMODDIR) -name 'modules.*' -delete; \
fe0ed8f9 95 fi
f68b9c81
RE
96 @# Debian ships tiny fake System.map files that are
97 @# syntactically valid but just say
98 @# "if you want system.map go install this package"
99 @# Naturally, depmod is less than amused by this.
100 @# So if we find it missing or with one of these present,
101 @# we check for the alternate path for the System.map
ed3a3bdb 102 sysmap=$(INSTALL_MOD_PATH)/boot/System.map-@LINUX_VERSION@; \
f68b9c81
RE
103 { [ -f "$$sysmap" ] && [ $$(wc -l < "$$sysmap") -ge 100 ]; } || \
104 sysmap=$(INSTALL_MOD_PATH)/usr/lib/debug/boot/System.map-@LINUX_VERSION@; \
c9c0d073
BB
105 if [ -f $$sysmap ]; then \
106 depmod -ae -F $$sysmap @LINUX_VERSION@; \
107 fi
c9c0d073 108
9f0a21e6
MM
109modules_install-FreeBSD:
110 @# Install the kernel modules
33982eb2 111 +$(FMAKE) install
9f0a21e6 112
bced7e3a
MM
113modules_install: modules_install-@ac_system@
114
c8970f52
AZ
115data_install-Linux:
116 @mkdir -p $(DESTDIR)/@prefix@/src/zfs-@VERSION@/@LINUX_VERSION@
117 cp ../zfs.release ../zfs_config.h @LINUX_SYMBOLS@ $(DESTDIR)/@prefix@/src/zfs-@VERSION@/@LINUX_VERSION@
118
119data_install-FreeBSD:
120 @
121
122data_install: data_install-@ac_system@
123
9b80d9e6 124modules_uninstall-Linux: modules_uninstall-Linux-legacy
6283f55e 125 @# Uninstall the kernel modules
ad9e7676 126 $(RM) $(addprefix $(KMODDIR)/$(INSTALL_MOD_DIR)/,zfs.ko spl.ko)
c9c0d073 127
9f0a21e6
MM
128modules_uninstall-FreeBSD:
129 @false
130
bced7e3a
MM
131modules_uninstall: modules_uninstall-@ac_system@
132
c8970f52
AZ
133data_uninstall-Linux:
134 $(RM) $(addprefix $(DESTDIR)/@prefix@/src/zfs-@VERSION@/@LINUX_VERSION@/,zfs.release zfs_config.h @LINUX_SYMBOLS@)
135
136data_uninstall-FreeBSD:
137 @
138
139data_uninstall: data_uninstall-@ac_system@
140
0e6c493f
BB
141cppcheck-Linux:
142 @CPPCHECK@ -j@CPU_COUNT@ --std=c99 --quiet --force --error-exitcode=2 \
6d680e61
DS
143 --inline-suppr \
144 --suppress=unmatchedSuppression \
145 --suppress=noValidConfiguration \
0e6c493f
BB
146 --enable=warning,information -D_KERNEL \
147 --include=@LINUX_OBJ@/include/generated/autoconf.h \
be91239e 148 --include=@top_builddir@/zfs_config.h \
0e6c493f 149 --config-exclude=@LINUX_OBJ@/include \
fe2ea67d 150 -i zstd/lib \
0e6c493f
BB
151 -I @LINUX_OBJ@/include \
152 -I @top_srcdir@/include/os/linux/kernel \
153 -I @top_srcdir@/include/os/linux/spl \
154 -I @top_srcdir@/include/os/linux/zfs \
155 -I @top_srcdir@/include \
ad9e7676 156 avl icp lua nvpair unicode zcommon zfs zstd os/linux
0e6c493f
BB
157
158cppcheck-FreeBSD:
159 @true
160
161cppcheck: cppcheck-@ac_system@
162
c9c0d073 163distdir:
ad9e7676 164 cd @srcdir@ && find . -name '*.[chS]' -exec sh -c 'for f; do mkdir -p $$distdir/$${f%/*}; cp @srcdir@/$$f $$distdir/$$f; done' _ {} +
7c902a51 165 cp @srcdir@/Makefile.bsd $$distdir/Makefile.bsd
ad9e7676
AZ
166
167gen-zstd-symbols:
168 for obj in $(addprefix zstd/,$(ZSTD_UPSTREAM_OBJS)); do echo; echo "/* $${obj#zstd/}: */"; @OBJDUMP@ -t $$obj | awk '$$2 == "g" && !/ zfs_/ {print "#define\t" $$6 " zfs_" $$6}' | sort; done >> zstd/include/zstd_compat_wrapper.h
169
170check-zstd-symbols:
9192ab77 171 @OBJDUMP@ -t $(addprefix zstd/,$(ZSTD_UPSTREAM_OBJS)) | awk '/file format/ {print} $$2 == "g" && (!/ zfs_/ && !/ __pfx_zfs_/) {++ret; print} END {exit ret}'