]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - Makefile.am
FreeBSD: Fixes required to build ZFS on PowerPC
[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
54 PHONY = gitrev
55 gitrev:
56         $(AM_V_GEN)$(top_srcdir)/scripts/make_gitrev.sh $(GITREV)
57
58 all: gitrev
59
60 # Double-colon rules are allowed; there are multiple independent definitions.
61 maintainer-clean-local::
62         -$(RM) $(GITREV)
63
64 distclean-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)
75
76 all-local:
77         -[ -x ${top_builddir}/scripts/zfs-tests.sh ] && \
78             ${top_builddir}/scripts/zfs-tests.sh -c
79
80 dist-hook:
81         $(AM_V_GEN)$(top_srcdir)/scripts/make_gitrev.sh -D $(distdir) $(GITREV)
82         $(SED) ${ac_inplace} -e 's/Release:[[:print:]]*/Release:      $(RELEASE)/' \
83                 $(distdir)/META
84
85 if BUILD_LINUX
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.
89 if CONFIG_KERNEL
90 install-data-hook:
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
101 endif
102 endif
103
104 PHONY += codecheck
105 codecheck: cstyle shellcheck checkbashisms flake8 mancheck testscheck vcscheck
106
107 PHONY += checkstyle
108 checkstyle: codecheck commitcheck
109
110 PHONY += commitcheck
111 commitcheck:
112         @if git rev-parse --git-dir > /dev/null 2>&1; then \
113                 ${top_srcdir}/scripts/commitcheck.sh; \
114         fi
115
116 PHONY += cstyle
117 cstyle:
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 {} \+
122
123 filter_executable = -exec test -x '{}' \; -print
124
125 PHONY += shellcheck
126 shellcheck:
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}); \
133         else \
134                 echo "skipping shellcheck because shellcheck is not installed"; \
135         fi
136
137 PHONY += checkbashisms
138 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*' \
147                                 ! -name 'libtool' \
148                         -exec bash -c 'awk "NR==1 && /\#\!.*bin\/sh.*/ {print FILENAME;}" "{}"' \;); \
149         else \
150                 echo "skipping checkbashisms because checkbashisms is not installed"; \
151         fi
152
153 PHONY += mancheck
154 mancheck:
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; \
160         else \
161                 echo "skipping mancheck because mandoc is not installed"; \
162         fi
163
164 if BUILD_LINUX
165 stat_fmt = -c '%A %n'
166 else
167 stat_fmt = -f '%Sp %N'
168 endif
169
170 PHONY += testscheck
171 testscheck:
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}'
179
180 PHONY += vcscheck
181 vcscheck:
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}' ; \
185         fi
186
187 PHONY += lint
188 lint: cppcheck paxcheck
189
190 PHONY += cppcheck
191 cppcheck:
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 \
196                         ${top_srcdir}; \
197         else \
198                 echo "skipping cppcheck because cppcheck is not installed"; \
199         fi
200
201 PHONY += paxcheck
202 paxcheck:
203         @if type scanelf > /dev/null 2>&1; then \
204                 ${top_srcdir}/scripts/paxcheck.sh ${top_builddir}; \
205         else \
206                 echo "skipping paxcheck because scanelf is not installed"; \
207         fi
208
209 PHONY += flake8
210 flake8:
211         @if type flake8 > /dev/null 2>&1; then \
212                 flake8 ${top_srcdir}; \
213         else \
214                 echo "skipping flake8 because flake8 is not installed"; \
215         fi
216
217 PHONY += ctags
218 ctags:
219         $(RM) tags
220         find $(top_srcdir) -name '.?*' -prune \
221                 -o -type f -name '*.[hcS]' -print | xargs ctags -a
222
223 PHONY += etags
224 etags:
225         $(RM) TAGS
226         find $(top_srcdir) -name '.?*' -prune \
227                 -o -type f -name '*.[hcS]' -print | xargs etags -a
228
229 PHONY += cscopelist
230 cscopelist:
231         find $(top_srcdir) -name '.?*' -prune \
232                 -o -type f -name '*.[hc]' -print >cscope.files
233
234 PHONY += tags
235 tags: ctags etags
236
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
242
243 include config/rpm.am
244 include config/deb.am
245 include config/tgz.am
246
247 .PHONY: $(PHONY)