]> granicus.if.org Git - zfs/blob - Makefile.am
pyzfs: python3 support (unit tests)
[zfs] / Makefile.am
1 ACLOCAL_AMFLAGS = -I config
2
3 include config/rpm.am
4 include config/deb.am
5 include config/tgz.am
6
7 SUBDIRS = include rpm
8 if CONFIG_USER
9 SUBDIRS += udev etc man scripts lib tests cmd contrib
10 endif
11 if CONFIG_KERNEL
12 SUBDIRS += module
13
14 extradir = $(prefix)/src/zfs-$(VERSION)
15 extra_HEADERS = zfs.release.in zfs_config.h.in
16
17 kerneldir = $(prefix)/src/zfs-$(VERSION)/$(LINUX_VERSION)
18 nodist_kernel_HEADERS = zfs.release zfs_config.h module/$(LINUX_SYMBOLS)
19 endif
20
21 AUTOMAKE_OPTIONS = foreign
22 EXTRA_DIST  = autogen.sh copy-builtin
23 EXTRA_DIST += config/config.awk config/rpm.am config/deb.am config/tgz.am
24 EXTRA_DIST += META AUTHORS COPYRIGHT LICENSE NEWS NOTICE README.md
25
26 @CODE_COVERAGE_RULES@
27
28 .PHONY: gitrev
29 gitrev:
30         -${top_srcdir}/scripts/make_gitrev.sh
31
32 BUILT_SOURCES = gitrev
33
34 distclean-local::
35         -$(RM) -R autom4te*.cache
36         -find . \( -name SCCS -o -name BitKeeper -o -name .svn -o -name CVS \
37                 -o -name .pc -o -name .hg -o -name .git \) -prune -o \
38                 \( -name '*.orig' -o -name '*.rej' -o -name '*~' \
39                 -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
40                 -o -name '.*.rej' -o -size 0 -o -name '*%' -o -name '.*.cmd' \
41                 -o -name 'core' -o -name 'Makefile' -o -name 'Module.symvers' \
42                 -o -name '*.order' -o -name '*.markers' -o -name '*.gcda' \
43                 -o -name '*.gcno' \) \
44                 -type f -print | xargs $(RM)
45
46 all-local:
47         -${top_srcdir}/scripts/zfs-tests.sh -c
48
49 dist-hook: gitrev
50         cp ${top_srcdir}/include/zfs_gitrev.h $(distdir)/include; \
51         sed -i 's/Release:[[:print:]]*/Release:      $(RELEASE)/' \
52                 $(distdir)/META
53
54 # For compatibility, create a matching spl-x.y.z directly which contains
55 # symlinks to the updated header and object file locations.  These
56 # compatibility links will be removed in the next major release.
57 if CONFIG_KERNEL
58 install-data-hook:
59         rm -rf $(DESTDIR)$(prefix)/src/spl-$(VERSION) && \
60         mkdir $(DESTDIR)$(prefix)/src/spl-$(VERSION) && \
61         cd $(DESTDIR)$(prefix)/src/spl-$(VERSION) && \
62         ln -s ../zfs-$(VERSION)/include/spl include && \
63         ln -s ../zfs-$(VERSION)/$(LINUX_VERSION) $(LINUX_VERSION) && \
64         ln -s ../zfs-$(VERSION)/zfs_config.h.in spl_config.h.in && \
65         ln -s ../zfs-$(VERSION)/zfs.release.in spl.release.in && \
66         cd $(DESTDIR)$(prefix)/src/zfs-$(VERSION)/$(LINUX_VERSION) && \
67         ln -fs zfs_config.h spl_config.h && \
68         ln -fs zfs.release spl.release
69 endif
70
71 codecheck: cstyle shellcheck flake8 mancheck testscheck
72
73 checkstyle: codecheck commitcheck
74
75 commitcheck:
76         @if git rev-parse --git-dir > /dev/null 2>&1; then \
77                 ${top_srcdir}/scripts/commitcheck.sh; \
78         fi
79
80 cstyle:
81         @find ${top_srcdir} -name '*.[hc]' ! -name 'zfs_config.*' \
82                 ! -name '*.mod.c' -type f \
83                 -exec ${top_srcdir}/scripts/cstyle.pl -cpP {} \+
84
85 shellcheck:
86         @if type shellcheck > /dev/null 2>&1; then \
87                 shellcheck --exclude=SC1090 --format=gcc \
88                         $$(find ${top_srcdir}/scripts/*.sh -type f) \
89                         $$(find ${top_srcdir}/cmd/zed/zed.d/*.sh -type f) \
90                         $$(find ${top_srcdir}/cmd/zpool/zpool.d/* -executable); \
91         else \
92                 echo "skipping shellcheck because shellcheck is not installed"; \
93         fi
94
95 mancheck:
96         @if type mandoc > /dev/null 2>&1; then \
97                 find ${top_srcdir}/man/man8 -type f -name 'zfs.8' \
98                         -o -name 'zpool.8' -o -name 'zdb.8' \
99                         -o -name 'zgenhostid.8' | \
100                         xargs mandoc -Tlint -Werror; \
101         else \
102                 echo "skipping mancheck because mandoc is not installed"; \
103         fi
104
105 testscheck:
106         @find ${top_srcdir}/tests/zfs-tests/tests -type f \
107                 \( -name '*.ksh' -not -executable \) -o \
108                 \( -name '*.kshlib' -executable \) -o \
109                 \( -name '*.cfg' -executable \) | \
110                 xargs -r stat -c '%A %n' | \
111                 awk '{c++; print} END {if(c>0) exit 1}'
112
113 lint: cppcheck paxcheck
114
115 cppcheck:
116         @if type cppcheck > /dev/null 2>&1; then \
117                 cppcheck --quiet --force --error-exitcode=2 --inline-suppr \
118                         --suppressions-list=.github/suppressions.txt \
119                         -UHAVE_SSE2 -UHAVE_AVX512F -UHAVE_UIO_ZEROCOPY \
120                         ${top_srcdir}; \
121         else \
122                 echo "skipping cppcheck because cppcheck is not installed"; \
123         fi
124
125 paxcheck:
126         @if type scanelf > /dev/null 2>&1; then \
127                 ${top_srcdir}/scripts/paxcheck.sh ${top_srcdir}; \
128         else \
129                 echo "skipping paxcheck because scanelf is not installed"; \
130         fi
131
132 flake8:
133         @if type flake8 > /dev/null 2>&1; then \
134                 flake8 ${top_srcdir}; \
135         else \
136                 echo "skipping flake8 because flake8 is not installed"; \
137         fi
138
139 ctags:
140         $(RM) tags
141         find $(top_srcdir) -name .git -prune -o -name '*.[hc]' | xargs ctags
142
143 etags:
144         $(RM) TAGS
145         find $(top_srcdir) -name .pc -prune -o -name '*.[hc]' | xargs etags -a
146
147 tags: ctags etags
148
149 pkg: @DEFAULT_PACKAGE@
150 pkg-dkms: @DEFAULT_PACKAGE@-dkms
151 pkg-kmod: @DEFAULT_PACKAGE@-kmod
152 pkg-utils: @DEFAULT_PACKAGE@-utils