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