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