]> git.proxmox.com Git - mirror_zfs.git/blame - module/Makefile.in
ARC shrinking blocks reads/writes
[mirror_zfs.git] / module / Makefile.in
CommitLineData
71504277 1include Kbuild
c9c0d073 2
d09f98a9
BB
3INSTALL_MOD_DIR ?= extra
4
d99a0153 5SUBDIR_TARGETS = icp lua
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 \
17 modules_uninstall modules_uninstall-Linux modules_uninstall-FreeBSD
18
33982eb2
AS
19# Filter out options that FreeBSD make doesn't understand
20getflags = ( \
21set -- \
22 $(filter-out --%,$(firstword $(MFLAGS))) \
23 $(filter -I%,$(MFLAGS)) \
24 $(filter -j%,$(MFLAGS)); \
25fmakeflags=""; \
26while getopts :deiI:j:knqrstw flag; do \
27 case $$flag in \
28 \?) :;; \
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; \
32 fi;; \
33 d) fmakeflags="$$fmakeflags -dA";; \
34 *) fmakeflags="$$fmakeflags -$$flag$$OPTARG";; \
35 esac; \
36done; \
37echo $$fmakeflags \
38)
39FMAKEFLAGS = -C @abs_srcdir@ -f Makefile.bsd $(shell $(getflags))
40
41ifneq (@abs_srcdir@,@abs_builddir@)
42FMAKEFLAGS += MAKEOBJDIR=@abs_builddir@
43endif
44FMAKE = env -u MAKEFLAGS make $(FMAKEFLAGS)
45
bced7e3a 46modules-Linux:
0b04990a
TC
47 list='$(SUBDIR_TARGETS)'; for targetdir in $$list; do \
48 $(MAKE) -C $$targetdir; \
49 done
bced7e3a
MM
50 $(MAKE) -C @LINUX_OBJ@ M=`pwd` @KERNEL_MAKE@ CONFIG_ZFS=m modules
51
9f0a21e6 52modules-FreeBSD:
33982eb2 53 +$(FMAKE)
9f0a21e6 54
bced7e3a
MM
55modules-unknown:
56 @true
57
58modules: modules-@ac_system@
c9c0d073 59
bced7e3a 60clean-Linux:
d433c206
BB
61 @# Only cleanup the kernel build directories when CONFIG_KERNEL
62 @# is defined. This indicates that kernel modules should be built.
bced7e3a 63@CONFIG_KERNEL_TRUE@ $(MAKE) -C @LINUX_OBJ@ M=`pwd` @KERNEL_MAKE@ clean
d433c206 64
c9c0d073
BB
65 if [ -f @LINUX_SYMBOLS@ ]; then $(RM) @LINUX_SYMBOLS@; fi
66 if [ -f Module.markers ]; then $(RM) Module.markers; fi
67
b669ab83
BB
68 find . -name '*.ur-safe' -type f -print | xargs $(RM)
69
9f0a21e6 70clean-FreeBSD:
33982eb2 71 +$(FMAKE) clean
9f0a21e6 72
bced7e3a
MM
73clean: clean-@ac_system@
74
75modules_install-Linux:
6283f55e 76 @# Install the kernel modules
bced7e3a 77 $(MAKE) -C @LINUX_OBJ@ M=`pwd` modules_install \
d09f98a9 78 INSTALL_MOD_PATH=$(DESTDIR)$(INSTALL_MOD_PATH) \
bb9d808c
AP
79 INSTALL_MOD_DIR=$(INSTALL_MOD_DIR) \
80 KERNELRELEASE=@LINUX_VERSION@
fe0ed8f9 81 @# Remove extraneous build products when packaging
d09f98a9 82 kmoddir=$(DESTDIR)$(INSTALL_MOD_PATH)/lib/modules/@LINUX_VERSION@; \
b0fe1ade 83 if [ -n "$(DESTDIR)" ]; then \
d09f98a9 84 find $$kmoddir -name 'modules.*' | xargs $(RM); \
fe0ed8f9 85 fi
d09f98a9 86 sysmap=$(DESTDIR)$(INSTALL_MOD_PATH)/boot/System.map-@LINUX_VERSION@; \
c9c0d073
BB
87 if [ -f $$sysmap ]; then \
88 depmod -ae -F $$sysmap @LINUX_VERSION@; \
89 fi
c9c0d073 90
9f0a21e6
MM
91modules_install-FreeBSD:
92 @# Install the kernel modules
33982eb2 93 +$(FMAKE) install
9f0a21e6 94
bced7e3a
MM
95modules_install: modules_install-@ac_system@
96
97modules_uninstall-Linux:
6283f55e 98 @# Uninstall the kernel modules
0b032548 99 kmoddir=$(DESTDIR)$(INSTALL_MOD_PATH)/lib/modules/@LINUX_VERSION@ \
71504277 100 list='$(ZFS_MODULES)'; for objdir in $$list; do \
ff4b68ee 101 $(RM) -R $$kmoddir/$(INSTALL_MOD_DIR)/$$objdir; \
d09f98a9 102 done
c9c0d073 103
9f0a21e6
MM
104modules_uninstall-FreeBSD:
105 @false
106
bced7e3a
MM
107modules_uninstall: modules_uninstall-@ac_system@
108
c9c0d073 109distdir:
71504277 110 list='$(ZFS_MODULES)'; for objdir in $$list os/linux/spl os/linux/zfs; do \
9f0a21e6
MM
111 (cd @top_srcdir@/module && find $$objdir -name '*.[chS]' | \
112 while read path; do \
113 mkdir -p @abs_top_builddir@/module/$$distdir/$${path%/*}; \
114 cp $$path @abs_top_builddir@/module/$$distdir/$$path; \
115 done); \
47a4a6fd 116 done