xref: /freebsd/sys/contrib/openzfs/Makefile.am (revision 70999532eea52da609e90c003b583ee0bfa5246b)
1CLEANFILES =
2dist_noinst_DATA =
3INSTALL_DATA_HOOKS =
4INSTALL_EXEC_HOOKS =
5ALL_LOCAL =
6CLEAN_LOCAL =
7CHECKS = shellcheck checkbashisms
8
9include $(top_srcdir)/config/Rules.am
10include $(top_srcdir)/config/CppCheck.am
11include $(top_srcdir)/config/Shellcheck.am
12include $(top_srcdir)/config/Substfiles.am
13include $(top_srcdir)/scripts/Makefile.am
14
15ACLOCAL_AMFLAGS = -I config
16
17SUBDIRS = include
18if BUILD_LINUX
19include $(srcdir)/%D%/rpm/Makefile.am
20endif
21
22if CONFIG_USER
23include $(srcdir)/%D%/cmd/Makefile.am
24include $(srcdir)/%D%/contrib/Makefile.am
25include $(srcdir)/%D%/etc/Makefile.am
26include $(srcdir)/%D%/lib/Makefile.am
27include $(srcdir)/%D%/man/Makefile.am
28include $(srcdir)/%D%/tests/Makefile.am
29if BUILD_LINUX
30include $(srcdir)/%D%/udev/Makefile.am
31endif
32endif
33CPPCHECKDIRS += module
34if CONFIG_KERNEL
35SUBDIRS += module
36
37extradir = $(prefix)/src/zfs-$(VERSION)
38extra_HEADERS = zfs.release.in zfs_config.h.in
39endif
40
41dist_noinst_DATA += autogen.sh copy-builtin
42dist_noinst_DATA += AUTHORS CODE_OF_CONDUCT.md COPYRIGHT LICENSE META NEWS NOTICE
43dist_noinst_DATA += README.md RELEASES.md
44dist_noinst_DATA += module/lua/README.zfs module/os/linux/spl/README.md
45
46# Include all the extra licensing information for modules
47dist_noinst_DATA += module/icp/algs/skein/THIRDPARTYLICENSE
48dist_noinst_DATA += module/icp/algs/skein/THIRDPARTYLICENSE.descrip
49dist_noinst_DATA += module/icp/asm-x86_64/aes/THIRDPARTYLICENSE.gladman
50dist_noinst_DATA += module/icp/asm-x86_64/aes/THIRDPARTYLICENSE.gladman.descrip
51dist_noinst_DATA += module/icp/asm-x86_64/aes/THIRDPARTYLICENSE.openssl
52dist_noinst_DATA += module/icp/asm-x86_64/aes/THIRDPARTYLICENSE.openssl.descrip
53dist_noinst_DATA += module/icp/asm-x86_64/modes/THIRDPARTYLICENSE.cryptogams
54dist_noinst_DATA += module/icp/asm-x86_64/modes/THIRDPARTYLICENSE.cryptogams.descrip
55dist_noinst_DATA += module/icp/asm-x86_64/modes/THIRDPARTYLICENSE.openssl
56dist_noinst_DATA += module/icp/asm-x86_64/modes/THIRDPARTYLICENSE.openssl.descrip
57dist_noinst_DATA += module/os/linux/spl/THIRDPARTYLICENSE.gplv2
58dist_noinst_DATA += module/os/linux/spl/THIRDPARTYLICENSE.gplv2.descrip
59dist_noinst_DATA += module/zfs/THIRDPARTYLICENSE.cityhash
60dist_noinst_DATA += module/zfs/THIRDPARTYLICENSE.cityhash.descrip
61
62@CODE_COVERAGE_RULES@
63
64GITREV = include/zfs_gitrev.h
65CLEANFILES += $(GITREV)
66PHONY += gitrev
67gitrev:
68	$(AM_V_GEN)$(top_srcdir)/scripts/make_gitrev.sh $(GITREV)
69
70all: gitrev
71
72PHONY += install-data-hook $(INSTALL_DATA_HOOKS)
73install-data-hook: $(INSTALL_DATA_HOOKS)
74
75PHONY += install-exec-hook $(INSTALL_EXEC_HOOKS)
76install-exec-hook: $(INSTALL_EXEC_HOOKS)
77
78PHONY += maintainer-clean-local
79maintainer-clean-local:
80	-$(RM) $(GITREV)
81
82PHONY += distclean-local
83distclean-local:
84	-$(RM) -R autom4te*.cache build
85	-find . \( -name SCCS -o -name BitKeeper -o -name .svn -o -name CVS \
86		-o -name .pc -o -name .hg -o -name .git \) -prune -o \
87		\( -name '*.orig' -o -name '*.rej' -o -name '*~' \
88		-o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
89		-o -name '.*.rej' -o -size 0 -o -name '*%' -o -name '.*.cmd' \
90		-o -name 'core' -o -name 'Makefile' -o -name 'Module.symvers' \
91		-o -name '*.order' -o -name '*.markers' -o -name '*.gcda' \
92		-o -name '*.gcno' \) \
93		-type f -delete
94
95PHONY += $(CLEAN_LOCAL)
96clean-local: $(CLEAN_LOCAL)
97
98PHONY += $(ALL_LOCAL)
99all-local: $(ALL_LOCAL)
100
101dist-hook:
102	$(top_srcdir)/scripts/make_gitrev.sh -D $(distdir) $(GITREV)
103	$(SED) $(ac_inplace) 's/\(Release:[[:space:]]*\).*/\1$(RELEASE)/' $(distdir)/META
104
105PHONY += codecheck $(CHECKS)
106codecheck: $(CHECKS)
107
108SHELLCHECKSCRIPTS += autogen.sh
109
110PHONY += checkstyle
111checkstyle: codecheck commitcheck
112
113PHONY += commitcheck
114commitcheck:
115	$(AM_V_at)if git rev-parse --git-dir > /dev/null 2>&1; then \
116		${top_srcdir}/scripts/commitcheck.sh; \
117	fi
118
119CHECKS += spdxcheck
120spdxcheck:
121	$(AM_V_at)$(top_srcdir)/scripts/spdxcheck.pl
122
123if HAVE_PARALLEL
124cstyle_line = -print0 | parallel -X0 ${top_srcdir}/scripts/cstyle.pl -cpP {}
125else
126cstyle_line = -exec ${top_srcdir}/scripts/cstyle.pl -cpP {} +
127endif
128CHECKS += cstyle
129cstyle:
130	$(AM_V_at)find $(top_srcdir) -name build -prune \
131		-o -type f -name '*.[hc]' \
132		! -name 'zfs_config.*' ! -name '*.mod.c' \
133		! -name 'opt_global.h' ! -name '*_if*.h' \
134		! -name 'zstd_compat_wrapper.h' \
135		! -path './module/zstd/lib/*' \
136		! -path './include/sys/lua/*' \
137		! -path './module/lua/l*.[ch]' \
138		! -path './module/zfs/lz4.c' \
139		$(cstyle_line)
140
141filter_executable = -exec test -x '{}' \; -print
142CHECKS += testscheck
143testscheck:
144	$(AM_V_at)[ $$(find $(top_srcdir)/tests/zfs-tests -type f \
145		\( -name '*.ksh' -not $(filter_executable) \) -o \
146		\( -name '*.kshlib' $(filter_executable) \) -o \
147		\( -name '*.shlib' $(filter_executable) \) -o \
148		\( -name '*.cfg' $(filter_executable) \) | \
149		tee /dev/stderr | wc -l) -eq 0 ]
150
151CHECKS += vcscheck
152vcscheck:
153	$(AM_V_at)if git rev-parse --git-dir > /dev/null 2>&1; then \
154		git ls-files . --exclude-standard --others | \
155		awk '{c++; print} END {if(c>0) exit 1}' ; \
156	fi
157
158CHECKS += zstdcheck
159zstdcheck:
160	@$(MAKE) -C module check-zstd-symbols
161
162PHONY += lint
163lint: cppcheck paxcheck
164
165PHONY += paxcheck
166paxcheck:
167	$(AM_V_at)if type scanelf > /dev/null 2>&1; then \
168		$(top_srcdir)/scripts/paxcheck.sh $(top_builddir); \
169	else \
170		echo "skipping paxcheck because scanelf is not installed"; \
171	fi
172
173CHECKS += flake8
174flake8:
175	$(AM_V_at)if type flake8 > /dev/null 2>&1; then \
176		flake8 $(top_srcdir); \
177	else \
178		echo "skipping flake8 because flake8 is not installed"; \
179	fi
180
181PHONY += regen-tests
182regen-tests:
183	@$(MAKE) -C tests/zfs-tests/tests regen
184
185PHONY += ctags
186ctags:
187	$(RM) tags
188	find $(top_srcdir) -name '.?*' -prune \
189		-o -type f -name '*.[hcS]' -exec ctags -a {} +
190
191PHONY += etags
192etags:
193	$(RM) TAGS
194	find $(top_srcdir) -name '.?*' -prune \
195		-o -type f -name '*.[hcS]' -exec etags -a {} +
196
197PHONY += cscopelist
198cscopelist:
199	find $(top_srcdir) -name '.?*' -prune \
200		-o -type f -name '*.[hc]' -print >cscope.files
201
202PHONY += tags
203tags: ctags etags
204
205PHONY += pkg pkg-dkms pkg-kmod pkg-utils
206pkg: @DEFAULT_PACKAGE@
207pkg-dkms: @DEFAULT_PACKAGE@-dkms
208pkg-kmod: @DEFAULT_PACKAGE@-kmod
209pkg-utils: @DEFAULT_PACKAGE@-utils
210
211include config/rpm.am
212include config/deb.am
213include config/tgz.am
214
215.PHONY: $(PHONY)
216