]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - Makefile.am
Ensure mount unit pilots when its ZFS key is loaded
[FreeBSD/FreeBSD.git] / Makefile.am
1 ACLOCAL_AMFLAGS = -I config
2
3 SUBDIRS = include
4 if BUILD_LINUX
5 SUBDIRS += rpm
6 endif
7
8 if CONFIG_USER
9 SUBDIRS += etc man scripts lib tests cmd contrib
10 if BUILD_LINUX
11 SUBDIRS += udev
12 endif
13 endif
14 if CONFIG_KERNEL
15 SUBDIRS += module
16
17 extradir = $(prefix)/src/zfs-$(VERSION)
18 extra_HEADERS = zfs.release.in zfs_config.h.in
19
20 if BUILD_LINUX
21 kerneldir = $(prefix)/src/zfs-$(VERSION)/$(LINUX_VERSION)
22 nodist_kernel_HEADERS = zfs.release zfs_config.h module/$(LINUX_SYMBOLS)
23 endif
24 endif
25
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
33
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
49
50 @CODE_COVERAGE_RULES@
51
52 GITREV = include/zfs_gitrev.h
53 CLEANFILES = $(GITREV)
54
55 PHONY = gitrev
56 gitrev:
57         $(AM_V_GEN)ZFS_GITREV=$$(cd $(top_srcdir) && \
58                 git describe --always --long --dirty 2>/dev/null); \
59         ZFS_GITREV=$${ZFS_GITREV:-unknown}; \
60         printf '#define\tZFS_META_GITREV "%s"\n' \
61                         "$${ZFS_GITREV}" >$(GITREV)~; \
62         if cmp -s $(GITREV) $(GITREV)~; then \
63                 $(RM) $(GITREV)~; \
64         else \
65                 mv -f $(GITREV)~ $(GITREV); \
66         fi
67
68 all: gitrev
69
70 # Double-colon rules are allowed; there are multiple independent definitions.
71 distclean-local::
72         -$(RM) -R autom4te*.cache build
73         -find . \( -name SCCS -o -name BitKeeper -o -name .svn -o -name CVS \
74                 -o -name .pc -o -name .hg -o -name .git \) -prune -o \
75                 \( -name '*.orig' -o -name '*.rej' -o -name '*~' \
76                 -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
77                 -o -name '.*.rej' -o -size 0 -o -name '*%' -o -name '.*.cmd' \
78                 -o -name 'core' -o -name 'Makefile' -o -name 'Module.symvers' \
79                 -o -name '*.order' -o -name '*.markers' -o -name '*.gcda' \
80                 -o -name '*.gcno' \) \
81                 -type f -print | xargs $(RM)
82
83 all-local:
84         -[ -x ${top_builddir}/scripts/zfs-tests.sh ] && \
85             ${top_builddir}/scripts/zfs-tests.sh -c
86
87 dist-hook:
88         $(SED) ${ac_inplace} -e 's/Release:[[:print:]]*/Release:      $(RELEASE)/' \
89                 $(distdir)/META
90
91 if BUILD_LINUX
92 # For compatibility, create a matching spl-x.y.z directly which contains
93 # symlinks to the updated header and object file locations.  These
94 # compatibility links will be removed in the next major release.
95 if CONFIG_KERNEL
96 install-data-hook:
97         rm -rf $(DESTDIR)$(prefix)/src/spl-$(VERSION) && \
98         mkdir $(DESTDIR)$(prefix)/src/spl-$(VERSION) && \
99         cd $(DESTDIR)$(prefix)/src/spl-$(VERSION) && \
100         ln -s ../zfs-$(VERSION)/include/spl include && \
101         ln -s ../zfs-$(VERSION)/$(LINUX_VERSION) $(LINUX_VERSION) && \
102         ln -s ../zfs-$(VERSION)/zfs_config.h.in spl_config.h.in && \
103         ln -s ../zfs-$(VERSION)/zfs.release.in spl.release.in && \
104         cd $(DESTDIR)$(prefix)/src/zfs-$(VERSION)/$(LINUX_VERSION) && \
105         ln -fs zfs_config.h spl_config.h && \
106         ln -fs zfs.release spl.release
107 endif
108 endif
109
110 PHONY += codecheck
111 codecheck: cstyle shellcheck checkbashisms flake8 mancheck testscheck vcscheck
112
113 PHONY += checkstyle
114 checkstyle: codecheck commitcheck
115
116 PHONY += commitcheck
117 commitcheck:
118         @if git rev-parse --git-dir > /dev/null 2>&1; then \
119                 ${top_srcdir}/scripts/commitcheck.sh; \
120         fi
121
122 PHONY += cstyle
123 cstyle:
124         @find ${top_srcdir} -name build -prune -o -type f -name '*.[hc]' \
125                 ! -name 'zfs_config.*' ! -name '*.mod.c' \
126                 ! -name 'opt_global.h' ! -name '*_if*.h' \
127                 -exec ${top_srcdir}/scripts/cstyle.pl -cpP {} \+
128
129 filter_executable = -exec test -x '{}' \; -print
130
131 PHONY += shellcheck
132 shellcheck:
133         @if type shellcheck > /dev/null 2>&1; then \
134                 shellcheck --exclude=SC1090 --exclude=SC1117 --format=gcc \
135                         $$(find ${top_srcdir}/scripts/*.sh -type f) \
136                         $$(find ${top_srcdir}/cmd/zed/zed.d/*.sh -type f) \
137                         $$(find ${top_srcdir}/cmd/zpool/zpool.d/* \
138                         -type f ${filter_executable}); \
139         else \
140                 echo "skipping shellcheck because shellcheck is not installed"; \
141         fi
142
143 PHONY += checkbashisms
144 checkbashisms:
145         @if type checkbashisms > /dev/null 2>&1; then \
146                 checkbashisms -n -p -x \
147                         $$(find ${top_srcdir} \
148                                 -name '.git' -prune \
149                                 -o -name 'build' -prune \
150                                 -o -name 'tests' -prune \
151                                 -o -name 'config' -prune \
152                                 -o -type f ! -name 'config*' \
153                                 ! -name 'libtool' \
154                         -exec bash -c 'awk "NR==1 && /\#\!.*bin\/sh.*/ {print FILENAME;}" "{}"' \;); \
155         else \
156                 echo "skipping checkbashisms because checkbashisms is not installed"; \
157         fi
158
159 PHONY += mancheck
160 mancheck:
161         @if type mandoc > /dev/null 2>&1; then \
162                 find ${top_srcdir}/man/man8 -type f -name 'zfs.8' \
163                         -o -name 'zpool.8' -o -name 'zdb.8' \
164                         -o -name 'zgenhostid.8' | \
165                         xargs mandoc -Tlint -Werror; \
166         else \
167                 echo "skipping mancheck because mandoc is not installed"; \
168         fi
169
170 if BUILD_LINUX
171 stat_fmt = -c '%A %n'
172 else
173 stat_fmt = -f '%Sp %N'
174 endif
175
176 PHONY += testscheck
177 testscheck:
178         @find ${top_srcdir}/tests/zfs-tests -type f \
179                 \( -name '*.ksh' -not ${filter_executable} \) -o \
180                 \( -name '*.kshlib' ${filter_executable} \) -o \
181                 \( -name '*.shlib' ${filter_executable} \) -o \
182                 \( -name '*.cfg' ${filter_executable} \) | \
183                 xargs -r stat ${stat_fmt} | \
184                 awk '{c++; print} END {if(c>0) exit 1}'
185
186 PHONY += vcscheck
187 vcscheck:
188         @if git rev-parse --git-dir > /dev/null 2>&1; then \
189                 git ls-files . --exclude-standard --others | \
190                 awk '{c++; print} END {if(c>0) exit 1}' ; \
191         fi
192
193 PHONY += lint
194 lint: cppcheck paxcheck
195
196 PHONY += cppcheck
197 cppcheck:
198         @if type cppcheck > /dev/null 2>&1; then \
199                 cppcheck --quiet --force --error-exitcode=2 --inline-suppr \
200                         --suppressions-list=${top_srcdir}/cppcheck-suppressions.txt \
201                         -UHAVE_SSE2 -UHAVE_AVX512F -UHAVE_UIO_ZEROCOPY \
202                         ${top_srcdir}; \
203         else \
204                 echo "skipping cppcheck because cppcheck is not installed"; \
205         fi
206
207 PHONY += paxcheck
208 paxcheck:
209         @if type scanelf > /dev/null 2>&1; then \
210                 ${top_srcdir}/scripts/paxcheck.sh ${top_builddir}; \
211         else \
212                 echo "skipping paxcheck because scanelf is not installed"; \
213         fi
214
215 PHONY += flake8
216 flake8:
217         @if type flake8 > /dev/null 2>&1; then \
218                 flake8 ${top_srcdir}; \
219         else \
220                 echo "skipping flake8 because flake8 is not installed"; \
221         fi
222
223 PHONY += ctags
224 ctags:
225         $(RM) tags
226         find $(top_srcdir) -name '.?*' -prune \
227                 -o -type f -name '*.[hcS]' -print | xargs ctags -a
228
229 PHONY += etags
230 etags:
231         $(RM) TAGS
232         find $(top_srcdir) -name '.?*' -prune \
233                 -o -type f -name '*.[hcS]' -print | xargs etags -a
234
235 PHONY += cscopelist
236 cscopelist:
237         find $(top_srcdir) -name '.?*' -prune \
238                 -o -type f -name '*.[hc]' -print >cscope.files
239
240 PHONY += tags
241 tags: ctags etags
242
243 PHONY += pkg pkg-dkms pkg-kmod pkg-utils
244 pkg: @DEFAULT_PACKAGE@
245 pkg-dkms: @DEFAULT_PACKAGE@-dkms
246 pkg-kmod: @DEFAULT_PACKAGE@-kmod
247 pkg-utils: @DEFAULT_PACKAGE@-utils
248
249 include config/rpm.am
250 include config/deb.am
251 include config/tgz.am
252
253 .PHONY: $(PHONY)