]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - Makefile.am
FreeBSD: Silence clang unused-but-set-variable
[FreeBSD/FreeBSD.git] / Makefile.am
1 include $(top_srcdir)/config/Shellcheck.am
2
3 ACLOCAL_AMFLAGS = -I config
4
5 SUBDIRS = include
6 if BUILD_LINUX
7 SUBDIRS += rpm
8 endif
9
10 if CONFIG_USER
11 SUBDIRS += man scripts lib tests cmd etc contrib
12 if BUILD_LINUX
13 SUBDIRS += udev
14 endif
15 endif
16 if CONFIG_KERNEL
17 SUBDIRS += module
18
19 extradir = $(prefix)/src/zfs-$(VERSION)
20 extra_HEADERS = zfs.release.in zfs_config.h.in
21
22 if BUILD_LINUX
23 kerneldir = $(prefix)/src/zfs-$(VERSION)/$(LINUX_VERSION)
24 nodist_kernel_HEADERS = zfs.release zfs_config.h module/$(LINUX_SYMBOLS)
25 endif
26 endif
27
28 AUTOMAKE_OPTIONS = foreign
29 EXTRA_DIST  = autogen.sh copy-builtin
30 EXTRA_DIST += config/config.awk config/rpm.am config/deb.am config/tgz.am
31 EXTRA_DIST += AUTHORS CODE_OF_CONDUCT.md COPYRIGHT LICENSE META NEWS NOTICE
32 EXTRA_DIST += README.md RELEASES.md
33 EXTRA_DIST += module/lua/README.zfs module/os/linux/spl/README.md
34
35 # Include all the extra licensing information for modules
36 EXTRA_DIST += module/icp/algs/skein/THIRDPARTYLICENSE
37 EXTRA_DIST += module/icp/algs/skein/THIRDPARTYLICENSE.descrip
38 EXTRA_DIST += module/icp/asm-x86_64/aes/THIRDPARTYLICENSE.gladman
39 EXTRA_DIST += module/icp/asm-x86_64/aes/THIRDPARTYLICENSE.gladman.descrip
40 EXTRA_DIST += module/icp/asm-x86_64/aes/THIRDPARTYLICENSE.openssl
41 EXTRA_DIST += module/icp/asm-x86_64/aes/THIRDPARTYLICENSE.openssl.descrip
42 EXTRA_DIST += module/icp/asm-x86_64/modes/THIRDPARTYLICENSE.cryptogams
43 EXTRA_DIST += module/icp/asm-x86_64/modes/THIRDPARTYLICENSE.cryptogams.descrip
44 EXTRA_DIST += module/icp/asm-x86_64/modes/THIRDPARTYLICENSE.openssl
45 EXTRA_DIST += module/icp/asm-x86_64/modes/THIRDPARTYLICENSE.openssl.descrip
46 EXTRA_DIST += module/os/linux/spl/THIRDPARTYLICENSE.gplv2
47 EXTRA_DIST += module/os/linux/spl/THIRDPARTYLICENSE.gplv2.descrip
48 EXTRA_DIST += module/zfs/THIRDPARTYLICENSE.cityhash
49 EXTRA_DIST += module/zfs/THIRDPARTYLICENSE.cityhash.descrip
50
51 @CODE_COVERAGE_RULES@
52
53 GITREV = include/zfs_gitrev.h
54
55 PHONY = gitrev
56 gitrev:
57         $(AM_V_GEN)$(top_srcdir)/scripts/make_gitrev.sh $(GITREV)
58
59 all: gitrev
60
61 # Double-colon rules are allowed; there are multiple independent definitions.
62 maintainer-clean-local::
63         -$(RM) $(GITREV)
64
65 distclean-local::
66         -$(RM) -R autom4te*.cache build
67         -find . \( -name SCCS -o -name BitKeeper -o -name .svn -o -name CVS \
68                 -o -name .pc -o -name .hg -o -name .git \) -prune -o \
69                 \( -name '*.orig' -o -name '*.rej' -o -name '*~' \
70                 -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
71                 -o -name '.*.rej' -o -size 0 -o -name '*%' -o -name '.*.cmd' \
72                 -o -name 'core' -o -name 'Makefile' -o -name 'Module.symvers' \
73                 -o -name '*.order' -o -name '*.markers' -o -name '*.gcda' \
74                 -o -name '*.gcno' \) \
75                 -type f -print | xargs $(RM)
76
77 all-local:
78         -[ -x ${top_builddir}/scripts/zfs-tests.sh ] && \
79             ${top_builddir}/scripts/zfs-tests.sh -c
80
81 dist-hook:
82         $(AM_V_GEN)$(top_srcdir)/scripts/make_gitrev.sh -D $(distdir) $(GITREV)
83         $(SED) ${ac_inplace} -e 's/Release:[[:print:]]*/Release:      $(RELEASE)/' \
84                 $(distdir)/META
85
86 if BUILD_LINUX
87 # For compatibility, create a matching spl-x.y.z directly which contains
88 # symlinks to the updated header and object file locations.  These
89 # compatibility links will be removed in the next major release.
90 if CONFIG_KERNEL
91 install-data-hook:
92         rm -rf $(DESTDIR)$(prefix)/src/spl-$(VERSION) && \
93         mkdir $(DESTDIR)$(prefix)/src/spl-$(VERSION) && \
94         cd $(DESTDIR)$(prefix)/src/spl-$(VERSION) && \
95         ln -s ../zfs-$(VERSION)/include/spl include && \
96         ln -s ../zfs-$(VERSION)/$(LINUX_VERSION) $(LINUX_VERSION) && \
97         ln -s ../zfs-$(VERSION)/zfs_config.h.in spl_config.h.in && \
98         ln -s ../zfs-$(VERSION)/zfs.release.in spl.release.in && \
99         cd $(DESTDIR)$(prefix)/src/zfs-$(VERSION)/$(LINUX_VERSION) && \
100         ln -fs zfs_config.h spl_config.h && \
101         ln -fs zfs.release spl.release
102 endif
103 endif
104
105 PHONY += codecheck
106 codecheck: cstyle shellcheck checkbashisms flake8 mancheck testscheck vcscheck zstdcheck
107
108 PHONY += checkstyle
109 checkstyle: codecheck commitcheck
110
111 PHONY += commitcheck
112 commitcheck:
113         @if git rev-parse --git-dir > /dev/null 2>&1; then \
114                 ${top_srcdir}/scripts/commitcheck.sh; \
115         fi
116
117 PHONY += cstyle
118 cstyle:
119         @find ${top_srcdir} -name build -prune \
120                 -o -type f -name '*.[hc]' \
121                 ! -name 'zfs_config.*' ! -name '*.mod.c' \
122                 ! -name 'opt_global.h' ! -name '*_if*.h' \
123                 ! -name 'zstd_compat_wrapper.h' \
124                 ! -path './module/zstd/lib/*' \
125                 -exec ${top_srcdir}/scripts/cstyle.pl -cpP {} \+
126
127 filter_executable = -exec test -x '{}' \; -print
128
129 SHELLCHECKDIRS = cmd contrib etc scripts tests
130 SHELLCHECKSCRIPTS = autogen.sh
131
132 PHONY += checkabi storeabi
133
134 checklibabiversion:
135         libabiversion=`abidw -v | $(SED) 's/[^0-9]//g'`; \
136         if test $$libabiversion -lt "200"; then \
137         /bin/echo -e "\n" \
138         "*** Please use libabigail 2.0.0 version or newer;\n" \
139         "*** otherwise results are not consistent!\n" \
140         "(or see https://github.com/openzfs/libabigail-docker )\n"; \
141         exit 1; \
142     fi;
143
144 checkabi: checklibabiversion lib
145         $(MAKE) -C lib checkabi
146
147 storeabi: checklibabiversion lib
148         $(MAKE) -C lib storeabi
149
150 PHONY += mancheck
151 mancheck:
152         ${top_srcdir}/scripts/mancheck.sh ${top_srcdir}/man ${top_srcdir}/tests/test-runner/man
153
154 if BUILD_LINUX
155 stat_fmt = -c '%A %n'
156 else
157 stat_fmt = -f '%Sp %N'
158 endif
159
160 PHONY += testscheck
161 testscheck:
162         @find ${top_srcdir}/tests/zfs-tests -type f \
163                 \( -name '*.ksh' -not ${filter_executable} \) -o \
164                 \( -name '*.kshlib' ${filter_executable} \) -o \
165                 \( -name '*.shlib' ${filter_executable} \) -o \
166                 \( -name '*.cfg' ${filter_executable} \) | \
167                 xargs -r stat ${stat_fmt} | \
168                 awk '{c++; print} END {if(c>0) exit 1}'
169
170 PHONY += vcscheck
171 vcscheck:
172         @if git rev-parse --git-dir > /dev/null 2>&1; then \
173                 git ls-files . --exclude-standard --others | \
174                 awk '{c++; print} END {if(c>0) exit 1}' ; \
175         fi
176
177 PHONY += zstdcheck
178 zstdcheck:
179         @$(MAKE) -C module/zstd checksymbols
180
181 PHONY += lint
182 lint: cppcheck paxcheck
183
184 CPPCHECKDIRS = cmd lib module
185 PHONY += cppcheck
186 cppcheck: $(CPPCHECKDIRS)
187         @if test -n "$(CPPCHECK)"; then \
188                 set -e ; for dir in $(CPPCHECKDIRS) ; do \
189                         $(MAKE) -C $$dir cppcheck ; \
190                 done \
191         else \
192                 echo "skipping cppcheck because cppcheck is not installed"; \
193         fi
194
195 PHONY += paxcheck
196 paxcheck:
197         @if type scanelf > /dev/null 2>&1; then \
198                 ${top_srcdir}/scripts/paxcheck.sh ${top_builddir}; \
199         else \
200                 echo "skipping paxcheck because scanelf is not installed"; \
201         fi
202
203 PHONY += flake8
204 flake8:
205         @if type flake8 > /dev/null 2>&1; then \
206                 flake8 ${top_srcdir}; \
207         else \
208                 echo "skipping flake8 because flake8 is not installed"; \
209         fi
210
211 PHONY += ctags
212 ctags:
213         $(RM) tags
214         find $(top_srcdir) -name '.?*' -prune \
215                 -o -type f -name '*.[hcS]' -print | xargs ctags -a
216
217 PHONY += etags
218 etags:
219         $(RM) TAGS
220         find $(top_srcdir) -name '.?*' -prune \
221                 -o -type f -name '*.[hcS]' -print | xargs etags -a
222
223 PHONY += cscopelist
224 cscopelist:
225         find $(top_srcdir) -name '.?*' -prune \
226                 -o -type f -name '*.[hc]' -print >cscope.files
227
228 PHONY += tags
229 tags: ctags etags
230
231 PHONY += pkg pkg-dkms pkg-kmod pkg-utils
232 pkg: @DEFAULT_PACKAGE@
233 pkg-dkms: @DEFAULT_PACKAGE@-dkms
234 pkg-kmod: @DEFAULT_PACKAGE@-kmod
235 pkg-utils: @DEFAULT_PACKAGE@-utils
236
237 include config/rpm.am
238 include config/deb.am
239 include config/tgz.am
240
241 .PHONY: $(PHONY)