]> git.proxmox.com Git - mirror_zfs.git/blob - Makefile.am
Fix tags targets in module/Makefile.in + cleanup
[mirror_zfs.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 += config/config.awk config/rpm.am config/deb.am config/tgz.am
33 EXTRA_DIST += META AUTHORS COPYRIGHT LICENSE NEWS NOTICE README.md
34 EXTRA_DIST += CODE_OF_CONDUCT.md
35
36 # Include all the extra licensing information for modules
37 EXTRA_DIST += module/icp/algs/skein/THIRDPARTYLICENSE
38 EXTRA_DIST += module/icp/algs/skein/THIRDPARTYLICENSE.descrip
39 EXTRA_DIST += module/icp/asm-x86_64/aes/THIRDPARTYLICENSE.gladman
40 EXTRA_DIST += module/icp/asm-x86_64/aes/THIRDPARTYLICENSE.gladman.descrip
41 EXTRA_DIST += module/icp/asm-x86_64/aes/THIRDPARTYLICENSE.openssl
42 EXTRA_DIST += module/icp/asm-x86_64/aes/THIRDPARTYLICENSE.openssl.descrip
43 EXTRA_DIST += module/os/linux/spl/THIRDPARTYLICENSE.gplv2
44 EXTRA_DIST += module/os/linux/spl/THIRDPARTYLICENSE.gplv2.descrip
45 EXTRA_DIST += module/zfs/THIRDPARTYLICENSE.cityhash
46 EXTRA_DIST += module/zfs/THIRDPARTYLICENSE.cityhash.descrip
47
48 @CODE_COVERAGE_RULES@
49
50 GITREV = include/zfs_gitrev.h
51
52 .PHONY: gitrev
53 gitrev:
54 ZFS_GITREV=$$(cd $(top_srcdir) && \
55 git describe --always --long --dirty 2>/dev/null); \
56 ZFS_GITREV=$${ZFS_GITREV:-unknown}; \
57 printf '#define\tZFS_META_GITREV "%s"\n' \
58 "$${ZFS_GITREV}" >$(GITREV)~; \
59 if cmp -s $(GITREV) $(GITREV)~; then \
60 $(RM) $(GITREV)~; \
61 else \
62 mv -f $(GITREV)~ $(GITREV); \
63 fi
64
65 $(GITREV): gitrev
66
67 BUILT_SOURCES = $(GITREV)
68 CLEANFILES = $(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 codecheck: cstyle shellcheck flake8 mancheck testscheck vcscheck
111
112 checkstyle: codecheck commitcheck
113
114 commitcheck:
115 @if git rev-parse --git-dir > /dev/null 2>&1; then \
116 ${top_srcdir}/scripts/commitcheck.sh; \
117 fi
118
119 cstyle:
120 @find ${top_srcdir} -name build -prune -o -type f -name '*.[hc]' \
121 ! -name 'zfs_config.*' ! -name '*.mod.c' \
122 ! -name 'opt_global.h' ! -name '*_if*.h' \
123 -exec ${top_srcdir}/scripts/cstyle.pl -cpP {} \+
124
125 filter_executable = -exec test -x '{}' \; -print
126
127 shellcheck:
128 @if type shellcheck > /dev/null 2>&1; then \
129 shellcheck --exclude=SC1090 --exclude=SC1117 --format=gcc \
130 $$(find ${top_srcdir}/scripts/*.sh -type f) \
131 $$(find ${top_srcdir}/cmd/zed/zed.d/*.sh -type f) \
132 $$(find ${top_srcdir}/cmd/zpool/zpool.d/* \
133 -type f ${filter_executable}); \
134 else \
135 echo "skipping shellcheck because shellcheck is not installed"; \
136 fi
137
138 mancheck:
139 @if type mandoc > /dev/null 2>&1; then \
140 find ${top_srcdir}/man/man8 -type f -name 'zfs.8' \
141 -o -name 'zpool.8' -o -name 'zdb.8' \
142 -o -name 'zgenhostid.8' | \
143 xargs mandoc -Tlint -Werror; \
144 else \
145 echo "skipping mancheck because mandoc is not installed"; \
146 fi
147
148 if BUILD_LINUX
149 stat_fmt = -c '%A %n'
150 else
151 stat_fmt = -f '%Sp %N'
152 endif
153
154 testscheck:
155 @find ${top_srcdir}/tests/zfs-tests -type f \
156 \( -name '*.ksh' -not ${filter_executable} \) -o \
157 \( -name '*.kshlib' ${filter_executable} \) -o \
158 \( -name '*.shlib' ${filter_executable} \) -o \
159 \( -name '*.cfg' ${filter_executable} \) | \
160 xargs -r stat ${stat_fmt} | \
161 awk '{c++; print} END {if(c>0) exit 1}'
162
163 vcscheck:
164 @if git rev-parse --git-dir > /dev/null 2>&1; then \
165 git ls-files . --exclude-standard --others | \
166 awk '{c++; print} END {if(c>0) exit 1}' ; \
167 fi
168
169 lint: cppcheck paxcheck
170
171 cppcheck:
172 @if type cppcheck > /dev/null 2>&1; then \
173 cppcheck --quiet --force --error-exitcode=2 --inline-suppr \
174 --suppressions-list=.github/suppressions.txt \
175 -UHAVE_SSE2 -UHAVE_AVX512F -UHAVE_UIO_ZEROCOPY \
176 ${top_srcdir}; \
177 else \
178 echo "skipping cppcheck because cppcheck is not installed"; \
179 fi
180
181 paxcheck:
182 @if type scanelf > /dev/null 2>&1; then \
183 ${top_srcdir}/scripts/paxcheck.sh ${top_srcdir}; \
184 else \
185 echo "skipping paxcheck because scanelf is not installed"; \
186 fi
187
188 flake8:
189 @if type flake8 > /dev/null 2>&1; then \
190 flake8 ${top_srcdir}; \
191 else \
192 echo "skipping flake8 because flake8 is not installed"; \
193 fi
194
195 ctags:
196 $(RM) tags
197 find $(top_srcdir) -name '.?*' -prune \
198 -o -type f -name '*.[hcS]' -print | xargs ctags -a
199
200 etags:
201 $(RM) TAGS
202 find $(top_srcdir) -name '.?*' -prune \
203 -o -type f -name '*.[hcS]' -print | xargs etags -a
204
205 cscopelist:
206 find $(top_srcdir) -name '.?*' -prune \
207 -o -type f -name '*.[hc]' -print >cscope.files
208
209 tags: ctags etags
210
211 pkg: @DEFAULT_PACKAGE@
212 pkg-dkms: @DEFAULT_PACKAGE@-dkms
213 pkg-kmod: @DEFAULT_PACKAGE@-kmod
214 pkg-utils: @DEFAULT_PACKAGE@-utils