]> git.proxmox.com Git - mirror_zfs.git/blob - module/Makefile.in
Fix libspl/asm-generic/atomic for VPATH build
[mirror_zfs.git] / module / Makefile.in
1 include Kbuild
2
3 INSTALL_MOD_DIR ?= extra
4
5 SUBDIR_TARGETS = icp lua
6
7 all: modules
8 distclean maintainer-clean: clean
9 install: modules_install
10 uninstall: modules_uninstall
11 check:
12
13 # Filter out options that FreeBSD make doesn't understand
14 getflags = ( \
15 set -- \
16 $(filter-out --%,$(firstword $(MFLAGS))) \
17 $(filter -I%,$(MFLAGS)) \
18 $(filter -j%,$(MFLAGS)); \
19 fmakeflags=""; \
20 while getopts :deiI:j:knqrstw flag; do \
21 case $$flag in \
22 \?) :;; \
23 :) if [ $$OPTARG = "j" ]; then \
24 ncpus=$$(sysctl -n kern.smp.cpus 2>/dev/null || :); \
25 if [ -n "$$ncpus" ]; then fmakeflags="$$fmakeflags -j$$ncpus"; fi; \
26 fi;; \
27 d) fmakeflags="$$fmakeflags -dA";; \
28 *) fmakeflags="$$fmakeflags -$$flag$$OPTARG";; \
29 esac; \
30 done; \
31 echo $$fmakeflags \
32 )
33 FMAKEFLAGS = -C @abs_srcdir@ -f Makefile.bsd $(shell $(getflags))
34
35 ifneq (@abs_srcdir@,@abs_builddir@)
36 FMAKEFLAGS += MAKEOBJDIR=@abs_builddir@
37 endif
38 FMAKE = env -u MAKEFLAGS make $(FMAKEFLAGS)
39
40 modules-Linux:
41 list='$(SUBDIR_TARGETS)'; for targetdir in $$list; do \
42 $(MAKE) -C $$targetdir; \
43 done
44 $(MAKE) -C @LINUX_OBJ@ M=`pwd` @KERNEL_MAKE@ CONFIG_ZFS=m modules
45
46 modules-FreeBSD:
47 +$(FMAKE)
48
49 modules-unknown:
50 @true
51
52 modules: modules-@ac_system@
53
54 clean-Linux:
55 @# Only cleanup the kernel build directories when CONFIG_KERNEL
56 @# is defined. This indicates that kernel modules should be built.
57 @CONFIG_KERNEL_TRUE@ $(MAKE) -C @LINUX_OBJ@ M=`pwd` @KERNEL_MAKE@ clean
58
59 if [ -f @LINUX_SYMBOLS@ ]; then $(RM) @LINUX_SYMBOLS@; fi
60 if [ -f Module.markers ]; then $(RM) Module.markers; fi
61
62 find . -name '*.ur-safe' -type f -print | xargs $(RM)
63
64 clean-FreeBSD:
65 +$(FMAKE) clean
66
67 clean: clean-@ac_system@
68
69 modules_install-Linux:
70 @# Install the kernel modules
71 $(MAKE) -C @LINUX_OBJ@ M=`pwd` modules_install \
72 INSTALL_MOD_PATH=$(DESTDIR)$(INSTALL_MOD_PATH) \
73 INSTALL_MOD_DIR=$(INSTALL_MOD_DIR) \
74 KERNELRELEASE=@LINUX_VERSION@
75 @# Remove extraneous build products when packaging
76 kmoddir=$(DESTDIR)$(INSTALL_MOD_PATH)/lib/modules/@LINUX_VERSION@; \
77 if [ -n "$(DESTDIR)" ]; then \
78 find $$kmoddir -name 'modules.*' | xargs $(RM); \
79 fi
80 sysmap=$(DESTDIR)$(INSTALL_MOD_PATH)/boot/System.map-@LINUX_VERSION@; \
81 if [ -f $$sysmap ]; then \
82 depmod -ae -F $$sysmap @LINUX_VERSION@; \
83 fi
84
85 CTAGS: ctags
86 ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
87 $(am__define_uniq_tagged_files); \
88 test -z "$(CTAGS_ARGS)$$unique" \
89 || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
90 $$unique
91
92 GTAGS:
93 here=`$(am__cd) $(top_builddir) && pwd` \
94 && $(am__cd) $(top_srcdir) \
95 && gtags -i $(GTAGS_ARGS) "$$here"
96 cscopelist: cscopelist-recursive
97
98 cscopelist-am: $(am__tagged_files)
99 list='$(am__tagged_files)'; \
100 case "$(srcdir)" in \
101 [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
102 *) sdir=$(subdir)/$(srcdir) ;; \
103 esac; \
104 for i in $$list; do \
105 if test -f "$$i"; then \
106 echo "$(subdir)/$$i"; \
107 else \
108 echo "$$sdir/$$i"; \
109 fi; \
110 done >> $(top_builddir)/cscope.files
111
112 modules_install-FreeBSD:
113 @# Install the kernel modules
114 +$(FMAKE) install
115
116 modules_install: modules_install-@ac_system@
117
118 modules_uninstall-Linux:
119 @# Uninstall the kernel modules
120 kmoddir=$(DESTDIR)$(INSTALL_MOD_PATH)/lib/modules/@LINUX_VERSION@
121 list='$(ZFS_MODULES)'; for objdir in $$list; do \
122 $(RM) -R $$kmoddir/$(INSTALL_MOD_DIR)/$$objdir; \
123 done
124
125 modules_uninstall-FreeBSD:
126 @false
127
128 modules_uninstall: modules_uninstall-@ac_system@
129
130 distdir:
131 list='$(ZFS_MODULES)'; for objdir in $$list os/linux/spl os/linux/zfs; do \
132 (cd @top_srcdir@/module && find $$objdir -name '*.[chS]' | \
133 while read path; do \
134 mkdir -p @abs_top_builddir@/module/$$distdir/$${path%/*}; \
135 cp $$path @abs_top_builddir@/module/$$distdir/$$path; \
136 done); \
137 done