Whamcloud - gitweb
LU-14139 statahead: add stats for batch RPC requests
[fs/lustre-release.git] / autoMakefile.am
1 # SPDX-License-Identifier: GPL-2.0
2
3 #
4 # This file is part of Lustre, http://www.lustre.org/
5 #
6 # autoMakefile.am
7 #
8 # Used by automake to create the top-level autoMakefile.in,
9 # which is used by config.status to create the top-level
10 # autoMakefile
11 #
12
13 SUBDIRS := @LDISKFS_SUBDIR@ \
14         . \
15         @LUSTREIOKIT_SUBDIR@ \
16         libcfs \
17         @SNMP_SUBDIR@ \
18         lnet \
19         lustre
20
21 DIST_SUBDIRS := ldiskfs \
22         lustre-iokit \
23         libcfs \
24         @SNMP_DIST_SUBDIR@ \
25         lnet \
26         lustre \
27         config
28
29 AUTOMAKE_OPTIONS = foreign
30
31 if DEQUOTE_CC_VERSION_TEXT
32 DEQUOTE = yes
33 endif
34
35 FIND_TAG_FILES_CMD = find $(top_srcdir) \
36                      -path $(top_srcdir)/ldiskfs/linux-stage \
37                      -prune -false -o -type f -name '*.[hc]'
38
39 # these empty rules are needed so that automake doesn't add its own
40 # recursive rules
41 etags-recursive:
42
43 ctags-recursive:
44
45 tags-recursive:
46
47 TAGS: etags
48
49 tags: ctags etags
50
51 etags:
52         $(RM) $(top_srcdir)/TAGS
53         ETAGSF=`etags --version | grep -iq exuberant && \
54                 echo "-I __initdata,__exitdata,EXPORT_SYMBOL"`; \
55         $(FIND_TAG_FILES_CMD) | xargs etags $$ETAGSF -a
56
57 ctags:
58         $(RM) $(top_srcdir)/tags
59         CTAGSF=`ctags --version | grep -iq exuberant && \
60                 echo "-I __initdata,__exitdata,EXPORT_SYMBOL"`; \
61         $(FIND_TAG_FILES_CMD) | xargs ctags $$CTAGSF -a
62
63 cscope-recursive:
64
65 cscope:
66         $(RM) $(top_srcdir)/cscope*.out $(top_srcdir)/cscope.files
67         $(FIND_TAG_FILES_CMD) > cscope.files
68         cscope -bRq
69
70 mkid:
71         $(FIND_TAG_FILES_CMD) | xargs mkid
72
73
74 doxygen:  doxygen-api doxygen-ref
75
76 doxygen-%: build/doxyfile.%
77         doxygen $<
78
79 if MODULES
80 .PHONY: ldiskfs-sources
81
82 ldiskfs-sources:
83 if LDISKFS_ENABLED
84         $(MAKE) sources -C @LDISKFS_SUBDIR@ || exit $$?
85 endif
86
87 if LINUX
88 all-am: modules
89
90 modules: undef.h ldiskfs-sources
91         $(MAKE) DEQUOTE_CC_VERSION_TEXT=$(DEQUOTE) \
92         LDFLAGS= CC="$(CC)" -C $(LINUX_OBJ) \
93         -f $(PWD)/build/Makefile LUSTRE_LINUX_CONFIG=$(LINUX_CONFIG) \
94         LINUXINCLUDE='-I$$(srctree)/arch/$$(SRCARCH)/include -Iarch/$$(SRCARCH)/include/generated -Iinclude $$(if $$(KBUILD_SRC)$$(building_out_of_srctree),-Iinclude2 -I$$(srctree)/include) -I$$(srctree)/arch/$$(SRCARCH)/include/uapi -Iarch/$$(SRCARCH)/include/generated/uapi -I$$(srctree)/include/uapi -Iinclude/generated/uapi -include $(CONFIG_INCLUDE)' \
95         $(MODULE_TARGET)=$(PWD) -o tmp_include_depends -o scripts -o \
96         include/config/MARKER $@
97 endif # LINUX
98
99 endif # MODULES
100
101 all: undef.h
102
103 undef.h: config.h.in
104         grep -v config.h.in config.h.in > $@
105
106 dist-hook: undef.h
107         find $(distdir) -name .deps -o \
108                         -name CVS -o \
109                         -name .svn -o \
110                         -name .git -o \
111                         -name .#* -exec rm -rf {} \;
112
113 EXTRA_DIST = @PACKAGE_TARNAME@.spec     \
114         build/Makefile                  \
115         build/Rules.in                  \
116         config.h.in                     \
117         lustre-dkms_pre-build.sh        \
118         lustre-dkms_post-build.sh       \
119         LUSTRE-VERSION-GEN              \
120         LUSTRE-VERSION-FILE             \
121         undef.h                         \
122         autogen.sh                      \
123         config/lustre-version.m4
124
125 # contrib is a directory.  Putting a directory in EXTRA_DIST
126 # recursively includes the entire directory contents in the
127 # distribution tarball (the tarball created with "make dist").
128 EXTRA_DIST += contrib
129 EXTRA_DIST += rpm
130
131 rpm-local:
132         @(if test -z "$(RPMBUILD)"; then \
133                 echo -e "\n" \
134         "*** Required util 'rpmbuild' missing. Please install the\n" \
135         "*** package for your distribution which provides 'rpmbuild',\n" \
136         "*** re-run configure, and try again.\n"; \
137                 exit 1; \
138         fi; \
139         $(MKDIR_P) $(rpmbuilddir)/TMP   && \
140         $(MKDIR_P) $(rpmbuilddir)/BUILD && \
141         $(MKDIR_P) $(rpmbuilddir)/RPMS  && \
142         $(MKDIR_P) $(rpmbuilddir)/SRPMS && \
143         $(MKDIR_P) $(rpmbuilddir)/SPECS && \
144         $(MKDIR_P) $(rpmbuilddir)/SOURCES)
145
146 if SERVER
147 dkms-srpm: $(PACKAGE)-dkms.spec dist Makefile
148         rpmbuilddir=`mktemp -t -d rpmbuild-@PACKAGE@-$$USER-XXXXXXXX`; \
149         $(MAKE) $(AM_MAKEFLAGS) \
150                 rpmbuilddir="$$rpmbuilddir" rpm-local || exit 1; \
151         $(RPMBUILD) \
152                 --define "_tmppath $$rpmbuilddir/TMP" \
153                 --define "_topdir $$rpmbuilddir" \
154                 --define "_sourcedir $(top_srcdir)" \
155                 --with servers --with zfs -without ldiskfs \
156                 --bs $(PACKAGE)-dkms.spec || exit 1; \
157         $(RPMBUILD) \
158                 --define "_tmppath $$rpmbuilddir/TMP" \
159                 --define "_topdir $$rpmbuilddir" \
160                 --define "_sourcedir $(top_srcdir)" \
161                 --with servers --without zfs --with ldiskfs \
162                 --bs $(PACKAGE)-dkms.spec || exit 1; \
163         $(RPMBUILD) \
164                 --define "_tmppath $$rpmbuilddir/TMP" \
165                 --define "_topdir $$rpmbuilddir" \
166                 --define "_sourcedir $(top_srcdir)" \
167                 --with servers --with zfs --with ldiskfs \
168                 --bs $(PACKAGE)-dkms.spec || exit 1; \
169         cp $$rpmbuilddir/SRPMS/*.src.rpm $(top_srcdir) || exit 1; \
170         rm -rf $$rpmbuilddir
171
172 dkms-rpm: dkms-srpm
173         rpmbuilddir=`mktemp -t -d rpmbuild-@PACKAGE@-$$USER-XXXXXXXX`; \
174         $(RPMBUILD) \
175                 --define "_tmppath $$rpmbuilddir/TMP" \
176                 --define "_topdir $$rpmbuilddir" \
177                 @RPMBUILD_BINARY_ARGS@ \
178                 --with servers --with zfs --without ldiskfs \
179                 --rebuild $(PACKAGE)-zfs-dkms-*.src.rpm || exit 1; \
180         $(RPMBUILD) \
181                 --define "_tmppath $$rpmbuilddir/TMP" \
182                 --define "_topdir $$rpmbuilddir" \
183                 @RPMBUILD_BINARY_ARGS@ \
184                 --with servers --without zfs --with ldiskfs \
185                 --rebuild $(PACKAGE)-ldiskfs-dkms-*.src.rpm || exit 1; \
186         $(RPMBUILD) \
187                 --define "_tmppath $$rpmbuilddir/TMP" \
188                 --define "_topdir $$rpmbuilddir" \
189                 @RPMBUILD_BINARY_ARGS@ \
190                 --with servers --with zfs --with ldiskfs \
191                 --rebuild $(PACKAGE)-all-dkms-*.src.rpm || exit 1; \
192         cp $$rpmbuilddir/RPMS/*/*.rpm $(top_srcdir) || exit 1; \
193         rm -rf $$rpmbuilddir
194 else
195
196 dkms-srpm: $(PACKAGE)-dkms.spec dist Makefile
197         rpmbuilddir=`mktemp -t -d rpmbuild-@PACKAGE@-$$USER-XXXXXXXX`; \
198         $(MAKE) $(AM_MAKEFLAGS) \
199                 rpmbuilddir="$$rpmbuilddir" rpm-local || exit 1; \
200         $(RPMBUILD) \
201                 --define "_tmppath $$rpmbuilddir/TMP" \
202                 --define "_topdir $$rpmbuilddir" \
203                 --define "_sourcedir $(top_srcdir)" \
204                 --without servers \
205                 --bs $(PACKAGE)-dkms.spec || exit 1; \
206         cp $$rpmbuilddir/SRPMS/*.src.rpm $(top_srcdir) || exit 1; \
207         rm -rf $$rpmbuilddir
208
209 dkms-rpm: dkms-srpm
210         rpmbuilddir=`mktemp -t -d rpmbuild-@PACKAGE@-$$USER-XXXXXXXX`; \
211         $(RPMBUILD) \
212                 --define "_tmppath $$rpmbuilddir/TMP" \
213                 --define "_topdir $$rpmbuilddir" \
214                 @RPMBUILD_BINARY_ARGS@ \
215                 --without servers \
216                 --rebuild $(PACKAGE)-client-dkms-*.src.rpm || exit 1; \
217         cp $$rpmbuilddir/RPMS/*/*.rpm $(top_srcdir) || exit 1; \
218         rm -rf $$rpmbuilddir
219
220 endif
221
222 dkms-srpms: dkms-srpm
223
224 dkms-rpms: dkms-rpm
225
226 rpms: srpm
227         rpmbuilddir=`mktemp -t -d rpmbuild-@PACKAGE@-$$USER-XXXXXXXX`; \
228         if test "x@CONFIG_CACHE_FILE@" != "x"; then \
229                 export CONFIG_CACHE_FILE="@CONFIG_CACHE_FILE@"; \
230         fi; \
231         $(MAKE) $(AM_MAKEFLAGS) \
232                 rpmbuilddir="$$rpmbuilddir" rpm-local || exit 1; \
233         $(RPMBUILD) \
234                 --define "_tmppath $$rpmbuilddir/TMP" \
235                 --define "_topdir $$rpmbuilddir" \
236                 @RPMBUILD_BINARY_ARGS@ \
237                 --rebuild $(distdir)-*.src.rpm || exit 1; \
238         cp $$rpmbuilddir/RPMS/*/*.rpm $(top_srcdir) || exit 1; \
239         rm -rf $$rpmbuilddir
240
241 srpm: @PACKAGE_TARNAME@.spec dist Makefile
242         rpmbuilddir=`mktemp -t -d rpmbuild-@PACKAGE@-$$USER-XXXXXXXX`; \
243         $(MAKE) $(AM_MAKEFLAGS) \
244                 rpmbuilddir="$$rpmbuilddir" rpm-local || exit 1; \
245         cp $(top_srcdir)/rpm/* $(top_srcdir); \
246         $(RPMBUILD) \
247                 --define "_tmppath $$rpmbuilddir/TMP" \
248                 --define "_topdir $$rpmbuilddir" \
249                 --define "dist %{nil}" \
250                 -ts $(distdir).tar.gz || exit 1; \
251         cp $$rpmbuilddir/SRPMS/$(distdir)-*.src.rpm $(top_srcdir) || exit 1; \
252         rm -rf $$rpmbuilddir
253
254 debs_common:
255         export SRC_GIT_HASH=$$(git log --oneline | head -1 | cut -d' ' -f1); \
256         rm -f /usr/src/lustre-$${SRC_GIT_HASH}.tar.bz2; \
257         if test -f /usr/src/lustre-$${SRC_GIT_HASH}.tar.bz2; then \
258                 echo "************************************************************" ; \
259                 echo "WARNING: move or remove /usr/src/lustre-$${SRC_GIT_HASH}.tar.bz2" ; \
260                 echo "************************************************************" ; \
261                 exit 1 ; \
262         fi
263 # In the debs target, first make sure what's in the changelog reflects
264 # the software version.
265 debs: undef.h debs_common
266         cp -v debian/changelog.in debian/changelog ; \
267         export SRC_GIT_HASH=$$(git log --oneline | head -1 | cut -d' ' -f1); \
268         lversion=$$(echo @VERSION@ | tr '_' '-'); \
269         cversion=$$(sed -ne '1s/^lustre (\(.*\)-[0-9][0-9]*).*$$/\1/p' debian/changelog); \
270         if [ "$$lversion" != "$$cversion" ]; then \
271                 echo -e "1i\nlustre ($$lversion-1) unstable; urgency=low\n\n  * Automated changelog entry update\n\n -- Andreas Dilger <adilger@whamcloud.com>  $$(date -R)\n\n.\nwq" | ed debian/changelog; \
272         fi; \
273         rm -rf debs; \
274         if test "x@ENABLE_SERVER@" = "xyes"; then \
275                 DEB_BUILD_PROFILES="server"; \
276         else \
277                 DEB_BUILD_PROFILES="client"; \
278         fi; \
279         if test "x@ENABLE_LDISKFS@" = "xyes"; then \
280                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} ldiskfs"; \
281         fi; \
282         if test "x@ENABLE_ZFS@" = "xyes"; then \
283                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} zfs"; \
284                 export SPL_SRC="@SPL@"; \
285                 export ZFS_SRC="@ZFS@"; \
286                 echo "ZFS support is enabled. Will expect pre-compiled SPL and ZFS sources in:"; \
287                 echo "SPL: $${SPL_SRC}"; \
288                 echo "ZFS: $${ZFS_SRC}"; \
289         fi; \
290         if test "x@ENABLEO2IB@" != "xno"; then \
291                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} o2ib"; \
292                 export O2IB_SRC="@O2IBPATH@"; \
293         fi; \
294         if test "x@CONFIG_CACHE_FILE@" != "x"; then \
295                 export CONFIG_CACHE_FILE="@CONFIG_CACHE_FILE@"; \
296         fi; \
297         if test "x@ENABLE_GSS@" = "xyes"; then \
298                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} gss"; \
299                 debiantmp=$$(mktemp -t -d debbuild-$$USER-XXXXXXXX) ; \
300                 cp debian/control $$debiantmp/control.bkp ; \
301                 cp debian/control.main $$debiantmp/control.main.bkp ; \
302                 cp debian/control.modules.in $$debiantmp/control.modules.in.bkp ; \
303                 sed -i "s+^\(Build-Depends: .*\)$$+\1, libkrb5-dev, libssl-dev+" debian/control.main ; \
304                 awk 'BEGIN{change=0} $$1 == "Package:" {if (($$2 == "lustre-client-utils") || ($$2 == "lustre-server-utils")) change=1; else change=0; fi } {if (($$1 == "Depends:") && change) print $$0 ", libgssapi-krb5-2, libkrb5-3, libssl1.1|libssl3"; else print; fi}' debian/control.main > $$debiantmp/control.main && mv $$debiantmp/control.main debian/control.main ; \
305                 sed -i "s+^\(Build-Depends: .*\)$$+\1, libkrb5-dev, libssl-dev+" debian/control.modules.in ; \
306         elif test "x@ENABLE_GSS@" = "xno"; then \
307                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} nogss"; \
308         fi; \
309         if test "x@ENABLE_CRYPTO@" = "xyes"; then \
310                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} crypto"; \
311         elif test "x@ENABLE_CRYPTO@" = "xno"; then \
312                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} nocrypto"; \
313         fi; \
314         if test "x@systemdsystemunitdir@" != "x"; then \
315                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} systemd"; \
316         fi; \
317         export KERNEL_OBJ="$(LINUX_OBJ)"; \
318         export KERNEL_SRC="$(LINUX)"; \
319         echo "Enabled Build Profiles: $${DEB_BUILD_PROFILES}"; \
320         echo "Kernel Source: $${KERNEL_SRC}"; \
321         echo "Kernel Object: $${KERNEL_OBJ}"; \
322         if test "x@ENABLEO2IB@" = "xno"; then \
323                 export IB_OPTIONS="--with-o2ib=no"; \
324         else \
325                 if test "x@ENABLEO2IB@" != "xyes" && \
326                    test -n "@O2IBPATH@"; then \
327                         export IB_OPTIONS="--with-o2ib=@O2IBPATH@"; \
328                 else \
329                         export IB_OPTIONS="--with-o2ib=yes"; \
330                 fi; \
331         fi; \
332         dpkg-buildpackage -us -uc -I.git -I\*.out[0-9]\* -I\*.swp || { \
333                 rc=$${PIPESTATUS[0]}; \
334                 cp $$debiantmp/control.bkp debian/control || true && \
335                 cp $$debiantmp/control.main.bkp debian/control.main || true && \
336                 cp $$debiantmp/control.modules.in.bkp debian/control.modules.in || true && \
337                 [ $${rc} -gt 1 ] && exit $${rc}; \
338                 exit 0; \
339         }; \
340         cp $$debiantmp/control.bkp debian/control || true && \
341         cp $$debiantmp/control.main.bkp debian/control.main || true && \
342         cp $$debiantmp/control.modules.in.bkp debian/control.modules.in || true && \
343         export KPKG_DEST_DIR="$$(pwd)/.." && \
344         version=$$(sed -ne '1s/^lustre (\(.*\)).*$$/\1/p' debian/changelog) && \
345         rm -rf debian/tmp/modules-deb && \
346         mkdir debian/tmp/modules-deb && \
347         pushd debian/tmp/modules-deb && \
348         dpkg -x ../../../../lustre-source_$${version}_all.deb $$(pwd) && \
349         mkdir usr_src/ && \
350         tar -C usr_src/ -xjf usr/src/lustre-$${SRC_GIT_HASH}.tar.bz2 && \
351         chmod 755 usr_src/modules/lustre/debian/rules && \
352         mkdir -p usr_share_modass && \
353         ln -s /usr/share/modass/include/ usr_share_modass/ && \
354         ln -s /usr/share/modass/packages/ usr_share_modass/ && \
355         echo "lustre" > usr_share_modass/compliant.list && \
356         export MA_DIR=$$(pwd)/usr_share_modass && \
357         KVERS=$${KVERS:-$(LINUXRELEASE)} && \
358         export KSRC_TREE=$(LINUX) && \
359         KSRC=$${KSRC:-$(LINUX_OBJ)} && \
360         TARBALL=$$(realpath usr/src/lustre-$${SRC_GIT_HASH}.tar.bz2) \
361         m-a build $${KSRC:+-k $$KSRC} $${KVERS:+-l $$KVERS} -i -u $$(pwd) lustre && \
362         popd && \
363         VER=$$(sed -ne '1s/^lustre (\(.*-[0-9][0-9]*\)).*$$/\1/p' debian/changelog) && \
364         if test "x@ENABLE_SERVER@" = "xyes"; then \
365                 DEB_SERVER_PKG="../lustre-resource-agents_$${VER}_*.deb"; \
366         fi; \
367         mkdir -p debs && \
368         mv ../lustre-dev_$${VER}_*.deb ../lustre-source_$${VER}_all.deb \
369            ../lustre-iokit_$${VER}_*.deb ../lustre-tests_$${VER}_*.deb \
370            ../lustre-*-utils_$${VER}_*.deb $${DEB_SERVER_PKG} \
371            ../lustre_$${VER}.dsc ../lustre_$${VER}_*.changes \
372            ../lustre_$${VER}.tar.gz ../lustre-*-modules-$${KVERS}_$${VER}_*.deb \
373            debs/
374
375 dkms-debs: undef.h debs_common
376         cp -v debian/changelog.in debian/changelog ; \
377         export SRC_GIT_HASH=$$(git log --oneline | head -1 | cut -d' ' -f1); \
378         lversion=$$(echo @VERSION@ | tr '_' '-'); \
379         cversion=$$(sed -ne '1s/^lustre (\(.*\)-[0-9][0-9]*).*$$/\1/p' debian/changelog); \
380         if [ "$$lversion" != "$$cversion" ]; then \
381                 echo -e "1i\nlustre ($$lversion-1) unstable; urgency=low\n\n  * Automated changelog entry update\n\n -- Brian J. Murrell <brian@interlinx.bc.ca>  $$(date -R)\n\n.\nwq" | ed debian/changelog; \
382         fi; \
383         rm -rf debs; \
384         export DEB_BUILD_PROFILES="client"; \
385         export KERNEL_OBJ="$(LINUX_OBJ)"; \
386         export KERNEL_SRC="$(LINUX)"; \
387         echo "Enabled Build Profiles: $${DEB_BUILD_PROFILES}"; \
388         echo "Kernel Source: $${KERNEL_SRC}"; \
389         echo "Kernel Object: $${KERNEL_OBJ}"; \
390         export BUILD_DKMS="true" && \
391         dpkg-buildpackage -us -uc -I.git -I\*.out[0-9]\* -I\*.swp || { \
392                 rc=$${PIPESTATUS[0]}; \
393                 [ $${rc} -gt 1 ] && exit $${rc}; \
394                 exit 0; \
395         }; \
396         VER=$$(sed -ne '1s/^lustre (\(.*-[0-9][0-9]*\)).*$$/\1/p' debian/changelog) && \
397         mkdir -p debs && \
398         mv ../lustre-dev_$${VER}_*.deb ../lustre-source_$${VER}_all.deb \
399            ../lustre-iokit_$${VER}_*.deb ../lustre-tests_$${VER}_*.deb \
400            ../lustre-*-utils_$${VER}_*.deb \
401            ../lustre_$${VER}.dsc ../lustre_$${VER}_*.changes \
402            ../lustre_$${VER}.tar.gz ../lustre-*-modules-dkms_$${VER}_*.deb \
403            debs/
404
405 EXTRA_DIST += debian/*
406
407 CSTK=/tmp/checkstack
408 CSTKO=/tmp/checkstack.orig
409
410 checkstack:
411         [ -f ${CSTK} -a ! -s ${CSTKO} ] && mv -f ${CSTK} ${CSTKO} || true
412         { for MOD in $$(find . -name "*.ko"); do                             \
413                 objdump -d $$MOD | perl contrib/scripts/checkstack.pl;       \
414           done } | grep -v " bug " | sort -nr | uniq > ${CSTK}
415         [ -f ${CSTKO} ] && ! diff -u ${CSTKO} ${CSTK} || head -n 30 ${CSTK}
416
417 checkstack-update:
418         [ -f ${CSTK} ] && mv -f ${CSTK} ${CSTKO}
419
420 checkstack-clean:
421         rm -f ${CSTK} ${CSTKO}