]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - Makefile.am
paxcheck needs to run against the builddir not the srcdir
[FreeBSD/FreeBSD.git] / 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
8 if BUILD_LINUX
9 SUBDIRS += rpm
10 endif
11
12 if CONFIG_USER
13 SUBDIRS += etc man scripts lib tests cmd contrib
14 if BUILD_LINUX
15 SUBDIRS += udev
16 endif
17 endif
18 if CONFIG_KERNEL
19 SUBDIRS += module
20
21 extradir = $(prefix)/src/zfs-$(VERSION)
22 extra_HEADERS = zfs.release.in zfs_config.h.in
23
24 if BUILD_LINUX
25 kerneldir = $(prefix)/src/zfs-$(VERSION)/$(LINUX_VERSION)
26 nodist_kernel_HEADERS = zfs.release zfs_config.h module/$(LINUX_SYMBOLS)
27 endif
28 endif
29
30 AUTOMAKE_OPTIONS = foreign
31 EXTRA_DIST  = autogen.sh copy-builtin
32 EXTRA_DIST += cppcheck-suppressions.txt
33 EXTRA_DIST += config/config.awk config/rpm.am config/deb.am config/tgz.am
34 EXTRA_DIST += META AUTHORS COPYRIGHT LICENSE NEWS NOTICE README.md
35 EXTRA_DIST += CODE_OF_CONDUCT.md
36 EXTRA_DIST += module/lua/README.zfs module/os/linux/spl/README.md
37
38 # Include all the extra licensing information for modules
39 EXTRA_DIST += module/icp/algs/skein/THIRDPARTYLICENSE
40 EXTRA_DIST += module/icp/algs/skein/THIRDPARTYLICENSE.descrip
41 EXTRA_DIST += module/icp/asm-x86_64/aes/THIRDPARTYLICENSE.gladman
42 EXTRA_DIST += module/icp/asm-x86_64/aes/THIRDPARTYLICENSE.gladman.descrip
43 EXTRA_DIST += module/icp/asm-x86_64/aes/THIRDPARTYLICENSE.openssl
44 EXTRA_DIST += module/icp/asm-x86_64/aes/THIRDPARTYLICENSE.openssl.descrip
45 EXTRA_DIST += module/icp/asm-x86_64/modes/THIRDPARTYLICENSE.cryptogams
46 EXTRA_DIST += module/icp/asm-x86_64/modes/THIRDPARTYLICENSE.cryptogams.descrip
47 EXTRA_DIST += module/icp/asm-x86_64/modes/THIRDPARTYLICENSE.openssl
48 EXTRA_DIST += module/icp/asm-x86_64/modes/THIRDPARTYLICENSE.openssl.descrip
49 EXTRA_DIST += module/os/linux/spl/THIRDPARTYLICENSE.gplv2
50 EXTRA_DIST += module/os/linux/spl/THIRDPARTYLICENSE.gplv2.descrip
51 EXTRA_DIST += module/zfs/THIRDPARTYLICENSE.cityhash
52 EXTRA_DIST += module/zfs/THIRDPARTYLICENSE.cityhash.descrip
53
54 @CODE_COVERAGE_RULES@
55
56 GITREV = include/zfs_gitrev.h
57
58 .PHONY: gitrev
59 gitrev:
60         ZFS_GITREV=$$(cd $(top_srcdir) && \
61                 git describe --always --long --dirty 2>/dev/null); \
62         ZFS_GITREV=$${ZFS_GITREV:-unknown}; \
63         printf '#define\tZFS_META_GITREV "%s"\n' \
64                         "$${ZFS_GITREV}" >$(GITREV)~; \
65         if cmp -s $(GITREV) $(GITREV)~; then \
66                 $(RM) $(GITREV)~; \
67         else \
68                 mv -f $(GITREV)~ $(GITREV); \
69         fi
70
71 $(GITREV): gitrev
72
73 BUILT_SOURCES = $(GITREV)
74 CLEANFILES = $(GITREV)
75
76 # Double-colon rules are allowed; there are multiple independent definitions.
77 distclean-local::
78         -$(RM) -R autom4te*.cache build
79         -find . \( -name SCCS -o -name BitKeeper -o -name .svn -o -name CVS \
80                 -o -name .pc -o -name .hg -o -name .git \) -prune -o \
81                 \( -name '*.orig' -o -name '*.rej' -o -name '*~' \
82                 -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
83                 -o -name '.*.rej' -o -size 0 -o -name '*%' -o -name '.*.cmd' \
84                 -o -name 'core' -o -name 'Makefile' -o -name 'Module.symvers' \
85                 -o -name '*.order' -o -name '*.markers' -o -name '*.gcda' \
86                 -o -name '*.gcno' \) \
87                 -type f -print | xargs $(RM)
88
89 all-local:
90         -[ -x ${top_builddir}/scripts/zfs-tests.sh ] && \
91             ${top_builddir}/scripts/zfs-tests.sh -c
92
93 dist-hook:
94         $(SED) ${ac_inplace} -e 's/Release:[[:print:]]*/Release:      $(RELEASE)/' \
95                 $(distdir)/META
96
97 if BUILD_LINUX
98 # For compatibility, create a matching spl-x.y.z directly which contains
99 # symlinks to the updated header and object file locations.  These
100 # compatibility links will be removed in the next major release.
101 if CONFIG_KERNEL
102 install-data-hook:
103         rm -rf $(DESTDIR)$(prefix)/src/spl-$(VERSION) && \
104         mkdir $(DESTDIR)$(prefix)/src/spl-$(VERSION) && \
105         cd $(DESTDIR)$(prefix)/src/spl-$(VERSION) && \
106         ln -s ../zfs-$(VERSION)/include/spl include && \
107         ln -s ../zfs-$(VERSION)/$(LINUX_VERSION) $(LINUX_VERSION) && \
108         ln -s ../zfs-$(VERSION)/zfs_config.h.in spl_config.h.in && \
109         ln -s ../zfs-$(VERSION)/zfs.release.in spl.release.in && \
110         cd $(DESTDIR)$(prefix)/src/zfs-$(VERSION)/$(LINUX_VERSION) && \
111         ln -fs zfs_config.h spl_config.h && \
112         ln -fs zfs.release spl.release
113 endif
114 endif
115
116 codecheck: cstyle shellcheck flake8 mancheck testscheck vcscheck
117
118 checkstyle: codecheck commitcheck
119
120 commitcheck:
121         @if git rev-parse --git-dir > /dev/null 2>&1; then \
122                 ${top_srcdir}/scripts/commitcheck.sh; \
123         fi
124
125 cstyle:
126         @find ${top_srcdir} -name build -prune -o -type f -name '*.[hc]' \
127                 ! -name 'zfs_config.*' ! -name '*.mod.c' \
128                 ! -name 'opt_global.h' ! -name '*_if*.h' \
129                 -exec ${top_srcdir}/scripts/cstyle.pl -cpP {} \+
130
131 filter_executable = -exec test -x '{}' \; -print
132
133 shellcheck:
134         @if type shellcheck > /dev/null 2>&1; then \
135                 shellcheck --exclude=SC1090 --exclude=SC1117 --format=gcc \
136                         $$(find ${top_srcdir}/scripts/*.sh -type f) \
137                         $$(find ${top_srcdir}/cmd/zed/zed.d/*.sh -type f) \
138                         $$(find ${top_srcdir}/cmd/zpool/zpool.d/* \
139                         -type f ${filter_executable}); \
140         else \
141                 echo "skipping shellcheck because shellcheck is not installed"; \
142         fi
143
144 mancheck:
145         @if type mandoc > /dev/null 2>&1; then \
146                 find ${top_srcdir}/man/man8 -type f -name 'zfs.8' \
147                         -o -name 'zpool.8' -o -name 'zdb.8' \
148                         -o -name 'zgenhostid.8' | \
149                         xargs mandoc -Tlint -Werror; \
150         else \
151                 echo "skipping mancheck because mandoc is not installed"; \
152         fi
153
154 if BUILD_LINUX
155 stat_fmt = -c '%A %n'
156 else
157 stat_fmt = -f '%Sp %N'
158 endif
159
160 testscheck:
161         @find ${top_srcdir}/tests/zfs-tests -type f \
162                 \( -name '*.ksh' -not ${filter_executable} \) -o \
163                 \( -name '*.kshlib' ${filter_executable} \) -o \
164                 \( -name '*.shlib' ${filter_executable} \) -o \
165                 \( -name '*.cfg' ${filter_executable} \) | \
166                 xargs -r stat ${stat_fmt} | \
167                 awk '{c++; print} END {if(c>0) exit 1}'
168
169 vcscheck:
170         @if git rev-parse --git-dir > /dev/null 2>&1; then \
171                 git ls-files . --exclude-standard --others | \
172                 awk '{c++; print} END {if(c>0) exit 1}' ; \
173         fi
174
175 lint: cppcheck paxcheck
176
177 cppcheck:
178         @if type cppcheck > /dev/null 2>&1; then \
179                 cppcheck --quiet --force --error-exitcode=2 --inline-suppr \
180                         --suppressions-list=${top_srcdir}/cppcheck-suppressions.txt \
181                         -UHAVE_SSE2 -UHAVE_AVX512F -UHAVE_UIO_ZEROCOPY \
182                         ${top_srcdir}; \
183         else \
184                 echo "skipping cppcheck because cppcheck is not installed"; \
185         fi
186
187 paxcheck:
188         @if type scanelf > /dev/null 2>&1; then \
189                 ${top_srcdir}/scripts/paxcheck.sh ${top_builddir}; \
190         else \
191                 echo "skipping paxcheck because scanelf is not installed"; \
192         fi
193
194 flake8:
195         @if type flake8 > /dev/null 2>&1; then \
196                 flake8 ${top_srcdir}; \
197         else \
198                 echo "skipping flake8 because flake8 is not installed"; \
199         fi
200
201 ctags:
202         $(RM) tags
203         find $(top_srcdir) -name '.?*' -prune \
204                 -o -type f -name '*.[hcS]' -print | xargs ctags -a
205
206 etags:
207         $(RM) TAGS
208         find $(top_srcdir) -name '.?*' -prune \
209                 -o -type f -name '*.[hcS]' -print | xargs etags -a
210
211 cscopelist:
212         find $(top_srcdir) -name '.?*' -prune \
213                 -o -type f -name '*.[hc]' -print >cscope.files
214
215 tags: ctags etags
216
217 pkg: @DEFAULT_PACKAGE@
218 pkg-dkms: @DEFAULT_PACKAGE@-dkms
219 pkg-kmod: @DEFAULT_PACKAGE@-kmod
220 pkg-utils: @DEFAULT_PACKAGE@-utils