]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - module/Makefile.in
Fix abd_get_offset_struct() may allocate new abd
[FreeBSD/FreeBSD.git] / module / Makefile.in
1 include Kbuild
2
3 INSTALL_MOD_DIR ?= extra
4
5 SUBDIR_TARGETS = icp lua zstd
6
7 all: modules
8 distclean maintainer-clean: clean
9 install: modules_install
10 uninstall: modules_uninstall
11 check:
12
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
19
20 # For FreeBSD, use debug options from ./configure if not overridden.
21 export WITH_DEBUG ?= @WITH_DEBUG@
22 export WITH_INVARIANTS ?= @WITH_INVARIANTS@
23
24 # Filter out options that FreeBSD make doesn't understand
25 getflags = ( \
26 set -- \
27   $(filter-out --%,$(firstword $(MFLAGS))) \
28   $(filter -I%,$(MFLAGS)) \
29   $(filter -j%,$(MFLAGS)); \
30 fmakeflags=""; \
31 while 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; \
41 done; \
42 echo $$fmakeflags \
43 )
44 FMAKEFLAGS = -C @abs_srcdir@ -f Makefile.bsd $(shell $(getflags))
45
46 ifneq (@abs_srcdir@,@abs_builddir@)
47 FMAKEFLAGS += MAKEOBJDIR=@abs_builddir@
48 endif
49
50 FMAKE = env -u MAKEFLAGS make $(FMAKEFLAGS)
51
52 modules-Linux:
53         list='$(SUBDIR_TARGETS)'; for targetdir in $$list; do \
54                 $(MAKE) -C $$targetdir; \
55         done
56         $(MAKE) -C @LINUX_OBJ@ M=`pwd` @KERNEL_MAKE@ CONFIG_ZFS=m modules
57
58 modules-FreeBSD:
59         +$(FMAKE)
60
61 modules-unknown:
62         @true
63
64 modules: modules-@ac_system@
65
66 clean-Linux:
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
70
71         if [ -f @LINUX_SYMBOLS@ ]; then $(RM) @LINUX_SYMBOLS@; fi
72         if [ -f Module.markers ]; then $(RM) Module.markers; fi
73
74         find . -name '*.ur-safe' -type f -print | xargs $(RM)
75
76 clean-FreeBSD:
77         +$(FMAKE) clean
78
79 clean: clean-@ac_system@
80
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); \
91         fi
92         sysmap=$(DESTDIR)$(INSTALL_MOD_PATH)/boot/System.map-@LINUX_VERSION@; \
93         if [ -f $$sysmap ]; then \
94                 depmod -ae -F $$sysmap @LINUX_VERSION@; \
95         fi
96
97 modules_install-FreeBSD:
98         @# Install the kernel modules
99         +$(FMAKE) install
100
101 modules_install: modules_install-@ac_system@
102
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; \
108         done
109
110 modules_uninstall-FreeBSD:
111         @false
112
113 modules_uninstall: modules_uninstall-@ac_system@
114
115 cppcheck-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
129 cppcheck-FreeBSD:
130         @true
131
132 cppcheck: cppcheck-@ac_system@
133
134 distdir:
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