]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - Makefile.am
filesystem_limit/snapshot_limit is incorrectly enforced against root
[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 PHONY += codecheck
117 codecheck: cstyle shellcheck checkbashisms flake8 mancheck testscheck vcscheck
118
119 PHONY += checkstyle
120 checkstyle: codecheck commitcheck
121
122 PHONY += commitcheck
123 commitcheck:
124         @if git rev-parse --git-dir > /dev/null 2>&1; then \
125                 ${top_srcdir}/scripts/commitcheck.sh; \
126         fi
127
128 PHONY += cstyle
129 cstyle:
130         @find ${top_srcdir} -name build -prune -o -type f -name '*.[hc]' \
131                 ! -name 'zfs_config.*' ! -name '*.mod.c' \
132                 ! -name 'opt_global.h' ! -name '*_if*.h' \
133                 -exec ${top_srcdir}/scripts/cstyle.pl -cpP {} \+
134
135 filter_executable = -exec test -x '{}' \; -print
136
137 PHONY += shellcheck
138 shellcheck:
139         @if type shellcheck > /dev/null 2>&1; then \
140                 shellcheck --exclude=SC1090 --exclude=SC1117 --format=gcc \
141                         $$(find ${top_srcdir}/scripts/*.sh -type f) \
142                         $$(find ${top_srcdir}/cmd/zed/zed.d/*.sh -type f) \
143                         $$(find ${top_srcdir}/cmd/zpool/zpool.d/* \
144                         -type f ${filter_executable}); \
145         else \
146                 echo "skipping shellcheck because shellcheck is not installed"; \
147         fi
148
149 PHONY += checkbashisms
150 checkbashisms:
151         @if type checkbashisms > /dev/null 2>&1; then \
152                 checkbashisms -n -p -x \
153                         $$(find ${top_srcdir} \
154                                 -name '.git' -prune \
155                                 -o -name 'build' -prune \
156                                 -o -name 'tests' -prune \
157                                 -o -name 'config' -prune \
158                                 -o -type f ! -name 'config*' \
159                                 ! -name 'libtool' \
160                         -exec bash -c 'awk "NR==1 && /\#\!.*bin\/sh.*/ {print FILENAME;}" "{}"' \;); \
161         else \
162                 echo "skipping checkbashisms because checkbashisms is not installed"; \
163         fi
164
165 PHONY += mancheck
166 mancheck:
167         @if type mandoc > /dev/null 2>&1; then \
168                 find ${top_srcdir}/man/man8 -type f -name 'zfs.8' \
169                         -o -name 'zpool.8' -o -name 'zdb.8' \
170                         -o -name 'zgenhostid.8' | \
171                         xargs mandoc -Tlint -Werror; \
172         else \
173                 echo "skipping mancheck because mandoc is not installed"; \
174         fi
175
176 if BUILD_LINUX
177 stat_fmt = -c '%A %n'
178 else
179 stat_fmt = -f '%Sp %N'
180 endif
181
182 PHONY += testscheck
183 testscheck:
184         @find ${top_srcdir}/tests/zfs-tests -type f \
185                 \( -name '*.ksh' -not ${filter_executable} \) -o \
186                 \( -name '*.kshlib' ${filter_executable} \) -o \
187                 \( -name '*.shlib' ${filter_executable} \) -o \
188                 \( -name '*.cfg' ${filter_executable} \) | \
189                 xargs -r stat ${stat_fmt} | \
190                 awk '{c++; print} END {if(c>0) exit 1}'
191
192 PHONY += vcscheck
193 vcscheck:
194         @if git rev-parse --git-dir > /dev/null 2>&1; then \
195                 git ls-files . --exclude-standard --others | \
196                 awk '{c++; print} END {if(c>0) exit 1}' ; \
197         fi
198
199 PHONY += lint
200 lint: cppcheck paxcheck
201
202 PHONY += cppcheck
203 cppcheck:
204         @if type cppcheck > /dev/null 2>&1; then \
205                 cppcheck --quiet --force --error-exitcode=2 --inline-suppr \
206                         --suppressions-list=${top_srcdir}/cppcheck-suppressions.txt \
207                         -UHAVE_SSE2 -UHAVE_AVX512F -UHAVE_UIO_ZEROCOPY \
208                         ${top_srcdir}; \
209         else \
210                 echo "skipping cppcheck because cppcheck is not installed"; \
211         fi
212
213 PHONY += paxcheck
214 paxcheck:
215         @if type scanelf > /dev/null 2>&1; then \
216                 ${top_srcdir}/scripts/paxcheck.sh ${top_builddir}; \
217         else \
218                 echo "skipping paxcheck because scanelf is not installed"; \
219         fi
220
221 PHONY += flake8
222 flake8:
223         @if type flake8 > /dev/null 2>&1; then \
224                 flake8 ${top_srcdir}; \
225         else \
226                 echo "skipping flake8 because flake8 is not installed"; \
227         fi
228
229 PHONY += ctags
230 ctags:
231         $(RM) tags
232         find $(top_srcdir) -name '.?*' -prune \
233                 -o -type f -name '*.[hcS]' -print | xargs ctags -a
234
235 PHONY += etags
236 etags:
237         $(RM) TAGS
238         find $(top_srcdir) -name '.?*' -prune \
239                 -o -type f -name '*.[hcS]' -print | xargs etags -a
240
241 PHONY += cscopelist
242 cscopelist:
243         find $(top_srcdir) -name '.?*' -prune \
244                 -o -type f -name '*.[hc]' -print >cscope.files
245
246 PHONY += tags
247 tags: ctags etags
248
249 PHONY += pkg pkg-dkms pkg-kmod pkg-utils
250 pkg: @DEFAULT_PACKAGE@
251 pkg-dkms: @DEFAULT_PACKAGE@-dkms
252 pkg-kmod: @DEFAULT_PACKAGE@-kmod
253 pkg-utils: @DEFAULT_PACKAGE@-utils
254
255 .PHONY: $(PHONY)