1 ACLOCAL_AMFLAGS = -I config
9 SUBDIRS += etc man scripts lib tests cmd contrib
17 extradir = $(prefix)/src/zfs-$(VERSION)
18 extra_HEADERS = zfs.release.in zfs_config.h.in
21 kerneldir = $(prefix)/src/zfs-$(VERSION)/$(LINUX_VERSION)
22 nodist_kernel_HEADERS = zfs.release zfs_config.h module/$(LINUX_SYMBOLS)
26 AUTOMAKE_OPTIONS = foreign
27 EXTRA_DIST = autogen.sh copy-builtin
28 EXTRA_DIST += cppcheck-suppressions.txt
29 EXTRA_DIST += config/config.awk config/rpm.am config/deb.am config/tgz.am
30 EXTRA_DIST += META AUTHORS COPYRIGHT LICENSE NEWS NOTICE README.md
31 EXTRA_DIST += CODE_OF_CONDUCT.md
32 EXTRA_DIST += module/lua/README.zfs module/os/linux/spl/README.md
34 # Include all the extra licensing information for modules
35 EXTRA_DIST += module/icp/algs/skein/THIRDPARTYLICENSE
36 EXTRA_DIST += module/icp/algs/skein/THIRDPARTYLICENSE.descrip
37 EXTRA_DIST += module/icp/asm-x86_64/aes/THIRDPARTYLICENSE.gladman
38 EXTRA_DIST += module/icp/asm-x86_64/aes/THIRDPARTYLICENSE.gladman.descrip
39 EXTRA_DIST += module/icp/asm-x86_64/aes/THIRDPARTYLICENSE.openssl
40 EXTRA_DIST += module/icp/asm-x86_64/aes/THIRDPARTYLICENSE.openssl.descrip
41 EXTRA_DIST += module/icp/asm-x86_64/modes/THIRDPARTYLICENSE.cryptogams
42 EXTRA_DIST += module/icp/asm-x86_64/modes/THIRDPARTYLICENSE.cryptogams.descrip
43 EXTRA_DIST += module/icp/asm-x86_64/modes/THIRDPARTYLICENSE.openssl
44 EXTRA_DIST += module/icp/asm-x86_64/modes/THIRDPARTYLICENSE.openssl.descrip
45 EXTRA_DIST += module/os/linux/spl/THIRDPARTYLICENSE.gplv2
46 EXTRA_DIST += module/os/linux/spl/THIRDPARTYLICENSE.gplv2.descrip
47 EXTRA_DIST += module/zfs/THIRDPARTYLICENSE.cityhash
48 EXTRA_DIST += module/zfs/THIRDPARTYLICENSE.cityhash.descrip
52 GITREV = include/zfs_gitrev.h
56 $(AM_V_GEN)$(top_srcdir)/scripts/make_gitrev.sh $(GITREV)
60 # Double-colon rules are allowed; there are multiple independent definitions.
61 maintainer-clean-local::
65 -$(RM) -R autom4te*.cache build
66 -find . \( -name SCCS -o -name BitKeeper -o -name .svn -o -name CVS \
67 -o -name .pc -o -name .hg -o -name .git \) -prune -o \
68 \( -name '*.orig' -o -name '*.rej' -o -name '*~' \
69 -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
70 -o -name '.*.rej' -o -size 0 -o -name '*%' -o -name '.*.cmd' \
71 -o -name 'core' -o -name 'Makefile' -o -name 'Module.symvers' \
72 -o -name '*.order' -o -name '*.markers' -o -name '*.gcda' \
73 -o -name '*.gcno' \) \
74 -type f -print | xargs $(RM)
77 -[ -x ${top_builddir}/scripts/zfs-tests.sh ] && \
78 ${top_builddir}/scripts/zfs-tests.sh -c
81 $(AM_V_GEN)$(top_srcdir)/scripts/make_gitrev.sh -D $(distdir) $(GITREV)
82 $(SED) ${ac_inplace} -e 's/Release:[[:print:]]*/Release: $(RELEASE)/' \
86 # For compatibility, create a matching spl-x.y.z directly which contains
87 # symlinks to the updated header and object file locations. These
88 # compatibility links will be removed in the next major release.
91 rm -rf $(DESTDIR)$(prefix)/src/spl-$(VERSION) && \
92 mkdir $(DESTDIR)$(prefix)/src/spl-$(VERSION) && \
93 cd $(DESTDIR)$(prefix)/src/spl-$(VERSION) && \
94 ln -s ../zfs-$(VERSION)/include/spl include && \
95 ln -s ../zfs-$(VERSION)/$(LINUX_VERSION) $(LINUX_VERSION) && \
96 ln -s ../zfs-$(VERSION)/zfs_config.h.in spl_config.h.in && \
97 ln -s ../zfs-$(VERSION)/zfs.release.in spl.release.in && \
98 cd $(DESTDIR)$(prefix)/src/zfs-$(VERSION)/$(LINUX_VERSION) && \
99 ln -fs zfs_config.h spl_config.h && \
100 ln -fs zfs.release spl.release
105 codecheck: cstyle shellcheck checkbashisms flake8 mancheck testscheck vcscheck
108 checkstyle: codecheck commitcheck
112 @if git rev-parse --git-dir > /dev/null 2>&1; then \
113 ${top_srcdir}/scripts/commitcheck.sh; \
118 @find ${top_srcdir} -name build -prune -o -type f -name '*.[hc]' \
119 ! -name 'zfs_config.*' ! -name '*.mod.c' \
120 ! -name 'opt_global.h' ! -name '*_if*.h' \
121 -exec ${top_srcdir}/scripts/cstyle.pl -cpP {} \+
123 filter_executable = -exec test -x '{}' \; -print
127 @if type shellcheck > /dev/null 2>&1; then \
128 shellcheck --exclude=SC1090 --exclude=SC1117 --format=gcc \
129 $$(find ${top_srcdir}/scripts/*.sh -type f) \
130 $$(find ${top_srcdir}/cmd/zed/zed.d/*.sh -type f) \
131 $$(find ${top_srcdir}/cmd/zpool/zpool.d/* \
132 -type f ${filter_executable}); \
134 echo "skipping shellcheck because shellcheck is not installed"; \
137 PHONY += checkbashisms
139 @if type checkbashisms > /dev/null 2>&1; then \
140 checkbashisms -n -p -x \
141 $$(find ${top_srcdir} \
142 -name '.git' -prune \
143 -o -name 'build' -prune \
144 -o -name 'tests' -prune \
145 -o -name 'config' -prune \
146 -o -type f ! -name 'config*' \
148 -exec bash -c 'awk "NR==1 && /\#\!.*bin\/sh.*/ {print FILENAME;}" "{}"' \;); \
150 echo "skipping checkbashisms because checkbashisms is not installed"; \
155 @if type mandoc > /dev/null 2>&1; then \
156 find ${top_srcdir}/man/man8 -type f -name 'zfs.8' \
157 -o -name 'zpool.8' -o -name 'zdb.8' \
158 -o -name 'zgenhostid.8' | \
159 xargs mandoc -Tlint -Werror; \
161 echo "skipping mancheck because mandoc is not installed"; \
165 stat_fmt = -c '%A %n'
167 stat_fmt = -f '%Sp %N'
172 @find ${top_srcdir}/tests/zfs-tests -type f \
173 \( -name '*.ksh' -not ${filter_executable} \) -o \
174 \( -name '*.kshlib' ${filter_executable} \) -o \
175 \( -name '*.shlib' ${filter_executable} \) -o \
176 \( -name '*.cfg' ${filter_executable} \) | \
177 xargs -r stat ${stat_fmt} | \
178 awk '{c++; print} END {if(c>0) exit 1}'
182 @if git rev-parse --git-dir > /dev/null 2>&1; then \
183 git ls-files . --exclude-standard --others | \
184 awk '{c++; print} END {if(c>0) exit 1}' ; \
188 lint: cppcheck paxcheck
192 @if type cppcheck > /dev/null 2>&1; then \
193 cppcheck --quiet --force --error-exitcode=2 --inline-suppr \
194 --suppressions-list=${top_srcdir}/cppcheck-suppressions.txt \
195 -UHAVE_SSE2 -UHAVE_AVX512F -UHAVE_UIO_ZEROCOPY \
198 echo "skipping cppcheck because cppcheck is not installed"; \
203 @if type scanelf > /dev/null 2>&1; then \
204 ${top_srcdir}/scripts/paxcheck.sh ${top_builddir}; \
206 echo "skipping paxcheck because scanelf is not installed"; \
211 @if type flake8 > /dev/null 2>&1; then \
212 flake8 ${top_srcdir}; \
214 echo "skipping flake8 because flake8 is not installed"; \
220 find $(top_srcdir) -name '.?*' -prune \
221 -o -type f -name '*.[hcS]' -print | xargs ctags -a
226 find $(top_srcdir) -name '.?*' -prune \
227 -o -type f -name '*.[hcS]' -print | xargs etags -a
231 find $(top_srcdir) -name '.?*' -prune \
232 -o -type f -name '*.[hc]' -print >cscope.files
237 PHONY += pkg pkg-dkms pkg-kmod pkg-utils
238 pkg: @DEFAULT_PACKAGE@
239 pkg-dkms: @DEFAULT_PACKAGE@-dkms
240 pkg-kmod: @DEFAULT_PACKAGE@-kmod
241 pkg-utils: @DEFAULT_PACKAGE@-utils
243 include config/rpm.am
244 include config/deb.am
245 include config/tgz.am