Whamcloud - gitweb
LU-17057 tests: Fix "...endpoint shutdown" under sanity-sec
[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         lnet \
18         lustre
19
20 DIST_SUBDIRS := ldiskfs \
21         lustre-iokit \
22         libcfs \
23         lnet \
24         lustre \
25         cc-plugins \
26         config
27
28 AUTOMAKE_OPTIONS = foreign
29
30 if DEQUOTE_CC_VERSION_TEXT
31 DEQUOTE = yes
32 endif
33
34 FIND_TAG_FILES_CMD = find $(top_srcdir) \
35                      -path $(top_srcdir)/ldiskfs/linux-stage \
36                      -prune -false -o -type f -name '*.[hc]'
37
38 help:
39         @echo  'Cleaning targets:'
40         @echo  '  clean             - Remove generated object files but keep the files'
41         @echo  '                      generated by autotools; use `git clean -xdf` to'
42         @echo  '                      purge all files not tracked by git'
43         @echo  ''
44         @echo  'Generic targets:'
45         @echo  '  all               - Build all modules and utilities enabled by'
46         @echo  '                      autotools'
47         @echo  '  checkpatch        - Run checkpatch.pl on latest commit'
48         @echo  '  checkstack        - Run checkstack.pl'
49         @echo  '  checkstack-update - Update checkstack.pl'
50         @echo  '  checkstack-clean  - Remove checkstack.pl artifacts'
51         @echo  ''
52         @echo  'Packaging targets:'
53         @echo  '  rpms              - Create RPM packages'
54         @echo  '  srpm              - Create source RPM packages'
55         @echo  '  dkms-rpm          - Create DKMS RPM packages'
56         @echo  '  dkms-srpm         - Create source DKMS RPM packages'
57         @echo  '  debs              - Create Debian packages'
58         @echo  '  dkms-debs         - Create DKMS Debian packages'
59
60 checkpatch:
61         @git diff HEAD~1 | ./contrib/scripts/checkpatch.pl
62
63 # these empty rules are needed so that automake doesn't add its own
64 # recursive rules
65 etags-recursive:
66
67 ctags-recursive:
68
69 tags-recursive:
70
71 TAGS: etags
72
73 tags: ctags etags
74
75 etags:
76         $(RM) $(top_srcdir)/TAGS
77         ETAGSF=`etags --version | grep -iq exuberant && \
78                 echo "-I __initdata,__exitdata,EXPORT_SYMBOL"`; \
79         $(FIND_TAG_FILES_CMD) | xargs etags $$ETAGSF -a
80
81 ctags:
82         $(RM) $(top_srcdir)/tags
83         CTAGSF=`ctags --version | grep -iq exuberant && \
84                 echo "-I __initdata,__exitdata,EXPORT_SYMBOL"`; \
85         $(FIND_TAG_FILES_CMD) | xargs ctags $$CTAGSF -a
86
87 cscope-recursive:
88
89 cscope:
90         $(RM) $(top_srcdir)/cscope*.out $(top_srcdir)/cscope.files
91         $(FIND_TAG_FILES_CMD) > cscope.files
92         cscope -bRq
93
94 mkid:
95         $(FIND_TAG_FILES_CMD) | xargs mkid
96
97
98 if MODULES
99 .PHONY: ldiskfs-sources
100
101 ldiskfs-sources:
102 if LDISKFS_ENABLED
103         $(MAKE) sources -C @LDISKFS_SUBDIR@ || exit $$?
104 endif
105 if BUILT_IN_KO2IBLND
106         $(MAKE) sources -C lnet/klnds/in-kernel-o2iblnd || exit $$?
107 endif
108
109 if LINUX
110 all-am: modules
111
112 modules: undef.h ldiskfs-sources
113         $(MAKE) DEQUOTE_CC_VERSION_TEXT=$(DEQUOTE) \
114         KBUILD_EXTRA_SYMBOLS="@INT_O2IB_SYMBOLS@ @EXTRA_SYMBOLS@" \
115         LDFLAGS= CC="$(CC)" -C $(LINUX_OBJ) \
116         -f $(PWD)/build/Makefile LUSTRE_LINUX_CONFIG=$(LINUX_CONFIG) \
117         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)' \
118         $(MODULE_TARGET)=$(PWD) -o tmp_include_depends -o scripts -o \
119         include/config/MARKER $@
120 if EXTERNAL_KO2IBLND
121         $(MAKE) DEQUOTE_CC_VERSION_TEXT=$(DEQUOTE) BUILD_EXT_O2IB=yes \
122         KBUILD_EXTRA_SYMBOLS="$(PWD)/Module.symvers @EXT_O2IB_SYMBOLS@ @EXTRA_SYMBOLS@" \
123         LDFLAGS= CC="$(CC)" -C $(LINUX_OBJ) \
124         -f $(PWD)/build/Makefile LUSTRE_LINUX_CONFIG=$(LINUX_CONFIG) \
125         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)' \
126         $(MODULE_TARGET)=$(PWD)/lnet/klnds/o2iblnd -o tmp_include_depends -o scripts -o \
127         include/config/MARKER $@
128 endif # EXTERNAL_KO2IBLND
129 endif # LINUX
130
131 endif # MODULES
132
133 all: plugins
134
135 # compiler plugins should be built as soon as possible,
136 # so they can be available to the rest of the build
137 # system
138 plugins: undef.h
139 if CC_PLUGINS
140         $(MAKE) all -C cc-plugins
141 endif # CC_PLUGINS
142
143 undef.h: config.h.in
144         grep -v config.h.in config.h.in > $@
145
146 dist-hook: undef.h
147         find $(distdir) -name .deps -o \
148                         -name CVS -o \
149                         -name .svn -o \
150                         -name .git -o \
151                         -name .#* -exec rm -rf {} \;
152
153 EXTRA_DIST = @PACKAGE_TARNAME@.spec     \
154         build/Makefile                  \
155         build/Rules.in                  \
156         config.h.in                     \
157         lustre-dkms_pre-build.sh        \
158         lustre-dkms_post-build.sh       \
159         LUSTRE-VERSION-GEN              \
160         LUSTRE-VERSION-FILE             \
161         undef.h                         \
162         autogen.sh                      \
163         modules.order                   \
164         config/lustre-version.m4
165
166 # contrib is a directory.  Putting a directory in EXTRA_DIST
167 # recursively includes the entire directory contents in the
168 # distribution tarball (the tarball created with "make dist").
169 EXTRA_DIST += contrib
170 EXTRA_DIST += rpm
171
172 rpm-local:
173         @(if test -z "$(RPMBUILD)"; then \
174                 echo -e "\n" \
175         "*** Required util 'rpmbuild' missing. Please install the\n" \
176         "*** package for your distribution which provides 'rpmbuild',\n" \
177         "*** re-run configure, and try again.\n"; \
178                 exit 1; \
179         fi; \
180         $(MKDIR_P) $(rpmbuilddir)/TMP   && \
181         $(MKDIR_P) $(rpmbuilddir)/BUILD && \
182         $(MKDIR_P) $(rpmbuilddir)/RPMS  && \
183         $(MKDIR_P) $(rpmbuilddir)/SRPMS && \
184         $(MKDIR_P) $(rpmbuilddir)/SPECS && \
185         $(MKDIR_P) $(rpmbuilddir)/SOURCES)
186
187 if SERVER
188 dkms-srpm: $(PACKAGE)-dkms.spec dist Makefile
189         rpmbuilddir=`mktemp -t -d rpmbuild-@PACKAGE@-$$USER-XXXXXXXX`; \
190         $(MAKE) $(AM_MAKEFLAGS) \
191                 rpmbuilddir="$$rpmbuilddir" rpm-local || exit 1; \
192         $(RPMBUILD) \
193                 --define "_tmppath $$rpmbuilddir/TMP" \
194                 --define "_topdir $$rpmbuilddir" \
195                 --define "_sourcedir $(top_srcdir)" \
196                 --with servers --with zfs -without ldiskfs \
197                 --bs $(PACKAGE)-dkms.spec || exit 1; \
198         $(RPMBUILD) \
199                 --define "_tmppath $$rpmbuilddir/TMP" \
200                 --define "_topdir $$rpmbuilddir" \
201                 --define "_sourcedir $(top_srcdir)" \
202                 --with servers --without zfs --with ldiskfs \
203                 --bs $(PACKAGE)-dkms.spec || exit 1; \
204         $(RPMBUILD) \
205                 --define "_tmppath $$rpmbuilddir/TMP" \
206                 --define "_topdir $$rpmbuilddir" \
207                 --define "_sourcedir $(top_srcdir)" \
208                 --with servers --with zfs --with ldiskfs \
209                 --bs $(PACKAGE)-dkms.spec || exit 1; \
210         cp $$rpmbuilddir/SRPMS/*.src.rpm $(top_srcdir) || exit 1; \
211         rm -rf $$rpmbuilddir
212
213 dkms-rpm: dkms-srpm
214         rpmbuilddir=`mktemp -t -d rpmbuild-@PACKAGE@-$$USER-XXXXXXXX`; \
215         $(RPMBUILD) \
216                 --define "_tmppath $$rpmbuilddir/TMP" \
217                 --define "_topdir $$rpmbuilddir" \
218                 @RPMBUILD_BINARY_ARGS@ \
219                 --with servers --with zfs --without ldiskfs \
220                 --rebuild $(PACKAGE)-zfs-dkms-*.src.rpm || exit 1; \
221         $(RPMBUILD) \
222                 --define "_tmppath $$rpmbuilddir/TMP" \
223                 --define "_topdir $$rpmbuilddir" \
224                 @RPMBUILD_BINARY_ARGS@ \
225                 --with servers --without zfs --with ldiskfs \
226                 --rebuild $(PACKAGE)-ldiskfs-dkms-*.src.rpm || exit 1; \
227         $(RPMBUILD) \
228                 --define "_tmppath $$rpmbuilddir/TMP" \
229                 --define "_topdir $$rpmbuilddir" \
230                 @RPMBUILD_BINARY_ARGS@ \
231                 --with servers --with zfs --with ldiskfs \
232                 --rebuild $(PACKAGE)-all-dkms-*.src.rpm || exit 1; \
233         cp $$rpmbuilddir/RPMS/*/*.rpm $(top_srcdir) || exit 1; \
234         rm -rf $$rpmbuilddir
235 else
236
237 dkms-srpm: $(PACKAGE)-dkms.spec dist Makefile
238         rpmbuilddir=`mktemp -t -d rpmbuild-@PACKAGE@-$$USER-XXXXXXXX`; \
239         $(MAKE) $(AM_MAKEFLAGS) \
240                 rpmbuilddir="$$rpmbuilddir" rpm-local || exit 1; \
241         $(RPMBUILD) \
242                 --define "_tmppath $$rpmbuilddir/TMP" \
243                 --define "_topdir $$rpmbuilddir" \
244                 --define "_sourcedir $(top_srcdir)" \
245                 --without servers \
246                 --bs $(PACKAGE)-dkms.spec || exit 1; \
247         cp $$rpmbuilddir/SRPMS/*.src.rpm $(top_srcdir) || exit 1; \
248         rm -rf $$rpmbuilddir
249
250 dkms-rpm: dkms-srpm
251         rpmbuilddir=`mktemp -t -d rpmbuild-@PACKAGE@-$$USER-XXXXXXXX`; \
252         $(RPMBUILD) \
253                 --define "_tmppath $$rpmbuilddir/TMP" \
254                 --define "_topdir $$rpmbuilddir" \
255                 @RPMBUILD_BINARY_ARGS@ \
256                 --without servers \
257                 --rebuild $(PACKAGE)-client-dkms-*.src.rpm || exit 1; \
258         cp $$rpmbuilddir/RPMS/*/*.rpm $(top_srcdir) || exit 1; \
259         rm -rf $$rpmbuilddir
260
261 endif
262
263 dkms-srpms: dkms-srpm
264
265 dkms-rpms: dkms-rpm
266
267 rpms: srpm
268         rpmbuilddir=`mktemp -t -d rpmbuild-@PACKAGE@-$$USER-XXXXXXXX`; \
269         if test "x@CONFIG_CACHE_FILE@" != "x"; then \
270                 export CONFIG_CACHE_FILE="@CONFIG_CACHE_FILE@"; \
271         fi; \
272         $(MAKE) $(AM_MAKEFLAGS) \
273                 rpmbuilddir="$$rpmbuilddir" rpm-local || exit 1; \
274         $(RPMBUILD) \
275                 --define "_tmppath $$rpmbuilddir/TMP" \
276                 --define "_topdir $$rpmbuilddir" \
277                 @RPMBUILD_BINARY_ARGS@ \
278                 --rebuild $(distdir)-*.src.rpm || exit 1; \
279         cp $$rpmbuilddir/RPMS/*/*.rpm $(top_srcdir) || exit 1; \
280         rm -rf $$rpmbuilddir
281
282 srpm: @PACKAGE_TARNAME@.spec dist Makefile
283         rpmbuilddir=`mktemp -t -d rpmbuild-@PACKAGE@-$$USER-XXXXXXXX`; \
284         $(MAKE) $(AM_MAKEFLAGS) \
285                 rpmbuilddir="$$rpmbuilddir" rpm-local || exit 1; \
286         cp $(top_srcdir)/rpm/* $(top_srcdir); \
287         $(RPMBUILD) \
288                 --define "_tmppath $$rpmbuilddir/TMP" \
289                 --define "_topdir $$rpmbuilddir" \
290                 --define "dist %{nil}" \
291                 -ts $(distdir).tar.gz || exit 1; \
292         cp $$rpmbuilddir/SRPMS/$(distdir)-*.src.rpm $(top_srcdir) || exit 1; \
293         rm -rf $$rpmbuilddir
294
295 debs_common:
296         export SRC_GIT_HASH=$$(git log --oneline | head -1 | cut -d' ' -f1); \
297         rm -f /usr/src/lustre-$${SRC_GIT_HASH}.tar.bz2; \
298         if test -f /usr/src/lustre-$${SRC_GIT_HASH}.tar.bz2; then \
299                 echo "************************************************************" ; \
300                 echo "WARNING: move or remove /usr/src/lustre-$${SRC_GIT_HASH}.tar.bz2" ; \
301                 echo "************************************************************" ; \
302                 exit 1 ; \
303         fi
304 # In the debs target, first make sure what's in the changelog reflects
305 # the software version.
306 debs: undef.h debs_common
307         cp -v debian/changelog.in debian/changelog ; \
308         export SRC_GIT_HASH=$$(git log --oneline | head -1 | cut -d' ' -f1); \
309         lversion=$$(echo @VERSION@ | tr '_' '-'); \
310         cversion=$$(sed -ne '1s/^lustre (\(.*\)-[0-9][0-9]*).*$$/\1/p' debian/changelog); \
311         if [ "$$lversion" != "$$cversion" ]; then \
312                 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; \
313         fi; \
314         rm -rf debs; \
315         if test "x@ENABLE_SERVER@" = "xyes"; then \
316                 DEB_BUILD_PROFILES="server"; \
317         else \
318                 DEB_BUILD_PROFILES="client"; \
319         fi; \
320         if test "x@ENABLE_LDISKFS@" = "xyes"; then \
321                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} ldiskfs"; \
322         fi; \
323         if test "x@ENABLE_ZFS@" = "xyes"; then \
324                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} zfs"; \
325                 export SPL_SRC="@SPL@"; \
326                 export ZFS_SRC="@ZFS@"; \
327                 echo "ZFS support is enabled. Will expect pre-compiled SPL and ZFS sources in:"; \
328                 echo "SPL: $${SPL_SRC}"; \
329                 echo "ZFS: $${ZFS_SRC}"; \
330         fi; \
331         if test "x@ENABLE_MULTIPLE_LNDS@" != "xno"; then \
332                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} multiple-lnds"; \
333         fi; \
334         if test "x@ENABLE_GNI@" = "xyes"; then \
335                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} gnilnd"; \
336         fi; \
337         if test "x@KFILND@" = "xkfilnd"; then \
338                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} kfilnd"; \
339         fi; \
340         if test "x@DPKG_EXT_O2IB@" != "x"; then \
341                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} ext_o2ib"; \
342                 export O2IB_SRC="@EXT_O2IBPATH@"; \
343         fi ; \
344         if test "x@DPKG_INT_O2IB@" != "x"; then \
345                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} int_o2ib"; \
346         fi; \
347         if test "x@CONFIG_CACHE_FILE@" != "x"; then \
348                 export CONFIG_CACHE_FILE="@CONFIG_CACHE_FILE@"; \
349         fi; \
350         if test "x@ENABLE_GSS@" = "xyes"; then \
351                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} gss"; \
352                 debiantmp=$$(mktemp -t -d debbuild-$$USER-XXXXXXXX) ; \
353                 cp debian/control.main $$debiantmp/control.main.bkp ; \
354                 cp debian/control.modules.in $$debiantmp/control.modules.in.bkp ; \
355                 sed -i "s+^\(Build-Depends: .*\)$$+\1, libkrb5-dev, libssl-dev+" debian/control.main ; \
356                 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 ; \
357                 sed -i "s+^\(Build-Depends: .*\)$$+\1, libkrb5-dev, libssl-dev+" debian/control.modules.in ; \
358         elif test "x@ENABLE_GSS@" = "xno"; then \
359                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} nogss"; \
360         fi; \
361         if test "x@ENABLE_CRYPTO@" = "xyes"; then \
362                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} crypto"; \
363         elif test "x@ENABLE_CRYPTO@" = "xno"; then \
364                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} nocrypto"; \
365         fi; \
366         if test "x@systemdsystemunitdir@" != "x"; then \
367                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} systemd"; \
368         fi; \
369         if test "x@ENABLE_PINGER@" = "xyes"; then \
370                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} pinger"; \
371         elif test "x@ENABLE_PINGER@" = "xno"; then \
372                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} nopinger"; \
373         fi; \
374         if test "x@ENABLE_CHECKSUM@" = "xyes"; then \
375                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} checksum"; \
376         elif test "x@ENABLE_CHECKSUM@" = "xno"; then \
377                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} nochecksum"; \
378         fi; \
379         if test "x@ENABLE_FLOCK@" = "xyes"; then \
380                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} flock"; \
381         elif test "x@ENABLE_FLOCK@" = "xno"; then \
382                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} noflock"; \
383         fi; \
384         if test "x@ENABLE_LRU_RESIZE@" = "xyes"; then \
385                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} lru-resize"; \
386         elif test "x@ENABLE_LRU_RESIZE@" = "xno"; then \
387                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} nolru-resize"; \
388         fi; \
389         if test "x@ENABLE_MINDF@" = "xyes"; then \
390                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} mindf"; \
391         elif test "x@ENABLE_MINDF@" = "xno"; then \
392                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} nomindf"; \
393         fi; \
394         if test "x@ENABLE_FAIL_ALLOC@" = "xyes"; then \
395                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} fail-alloc"; \
396         elif test "x@ENABLE_FAIL_ALLOC@" = "xno"; then \
397                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} nofail-alloc"; \
398         fi; \
399         if test "x@ENABLE_INVARIANTS@" = "xyes"; then \
400                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} invariants"; \
401         elif test "x@ENABLE_INVARIANTS@" = "xno"; then \
402                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} noinvariants"; \
403         fi; \
404         if test "x@ENABLE_LU_REF@" = "xyes"; then \
405                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} lu_ref"; \
406         elif test "x@ENABLE_LU_REF@" = "xno"; then \
407                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} nolu_ref"; \
408         fi; \
409         if test "x@ENABLE_PGSTAT_TRACK@" = "xyes"; then \
410                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} pgstate-track"; \
411         elif test "x@ENABLE_PGSTAT_TRACK@" = "xno"; then \
412                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} nopgstate-track"; \
413         fi; \
414         if test "x@ENABLE_LIBCFS_CDEBUG@" = "xyes"; then \
415                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} libcfs-cdebug"; \
416         elif test "x@ENABLE_LIBCFS_CDEBUG@" = "xno"; then \
417                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} nolibcfs-cdebug"; \
418         fi; \
419         if test "x@ENABLE_LIBCFS_TRACE@" = "xyes"; then \
420                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} libcfs-trace"; \
421         elif test "x@ENABLE_LIBCFS_TRACE@" = "xno"; then \
422                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} nolibcfs-trace"; \
423         fi; \
424         if test "x@ENABLE_LIBCFS_ASSERT@" = "xyes"; then \
425                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} libcfs-assert"; \
426         elif test "x@ENABLE_LIBCFS_ASSERT@" = "xno"; then \
427                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} nolibcfs-assert"; \
428         fi; \
429         if test "x@ENABLE_PANIC_DUMPLOG@" = "xyes"; then \
430                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} panic_dumplog"; \
431         elif test "x@ENABLE_PANIC_DUMPLOG@" = "xno"; then \
432                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} nopanic_dumplog"; \
433         fi; \
434         if test "x@ENABLE_READLINE@" = "xyes"; then \
435                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} readline"; \
436         elif test "x@ENABLE_READLINE@" = "xno"; then \
437                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} noreadline"; \
438         fi; \
439         if test "x@ENABLE_LIBPTHREAD@" = "xyes"; then \
440                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} libpthread"; \
441         elif test "x@ENABLE_LIBPTHREAD@" = "xno"; then \
442                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} nolibpthread"; \
443         fi; \
444         if test "x@ENABLE_BACKOFF@" = "xyes"; then \
445                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} backoff"; \
446         elif test "x@ENABLE_BACKOFF@" = "xno"; then \
447                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} nobackoff"; \
448         fi; \
449         if test "x@ENABLE_EFENCE@" = "xyes"; then \
450                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} efence"; \
451         elif test "x@ENABLE_EFENCE@" = "xno"; then \
452                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} noefence"; \
453         fi; \
454         export KERNEL_OBJ="$(LINUX_OBJ)"; \
455         export KERNEL_SRC="$(LINUX)"; \
456         echo "Enabled Build Profiles: $${DEB_BUILD_PROFILES}"; \
457         echo "Kernel Source: $${KERNEL_SRC}"; \
458         echo "Kernel Object: $${KERNEL_OBJ}"; \
459         if test "x@ENABLEO2IB@" = "xno"; then \
460                 export IB_OPTIONS="--with-o2ib=no"; \
461         else \
462                 if test "x@ENABLEO2IB@" != "xyes" && \
463                    test -n "@O2IBPATH@"; then \
464                         export IB_OPTIONS="--with-o2ib=@O2IBPATH@"; \
465                 else \
466                         export IB_OPTIONS="--with-o2ib=yes"; \
467                 fi; \
468         fi; \
469         cp -v debian/control.main debian/control ; \
470         sed "s/_KVERS_/$(LINUXRELEASE)/g" debian/lustre-tests.install.in \
471                 > debian/lustre-tests.install; \
472         tmpprofiles=`tr ' ' ',' <<< $$DEB_BUILD_PROFILES`; \
473         dpkg-buildpackage -us -uc -I.git -I\*.out[0-9]\* -I\*.swp -P$$tmpprofiles || { \
474                 rc=$${PIPESTATUS[0]}; \
475                 cp $$debiantmp/control.main.bkp debian/control.main || true && \
476                 cp $$debiantmp/control.modules.in.bkp debian/control.modules.in || true && \
477                 [ $${rc} -gt 1 ] && exit $${rc}; \
478                 exit 0; \
479         }; \
480         cp $$debiantmp/control.main.bkp debian/control.main || true && \
481         cp $$debiantmp/control.modules.in.bkp debian/control.modules.in || true && \
482         cp -v debian/control.main debian/control || true ; \
483         export KPKG_DEST_DIR="$$(pwd)/.." && \
484         version=$$(sed -ne '1s/^lustre (\(.*\)).*$$/\1/p' debian/changelog) && \
485         rm -rf debian/tmp/modules-deb && \
486         mkdir debian/tmp/modules-deb && \
487         pushd debian/tmp/modules-deb && \
488         dpkg -x ../../../../lustre-source_$${version}_all.deb $$(pwd) && \
489         mkdir usr_src/ && \
490         tar -C usr_src/ -xjf usr/src/lustre-$${SRC_GIT_HASH}.tar.bz2 && \
491         chmod 755 usr_src/modules/lustre/debian/rules && \
492         mkdir -p usr_share_modass && \
493         ln -s /usr/share/modass/include/ usr_share_modass/ && \
494         ln -s /usr/share/modass/packages/ usr_share_modass/ && \
495         echo "lustre" > usr_share_modass/compliant.list && \
496         export MA_DIR=$$(pwd)/usr_share_modass && \
497         KVERS=$${KVERS:-$(LINUXRELEASE)} && \
498         export KSRC_TREE=$(LINUX) && \
499         KSRC=$${KSRC:-$(LINUX_OBJ)} && \
500         TARBALL=$$(realpath usr/src/lustre-$${SRC_GIT_HASH}.tar.bz2) \
501         m-a build $${KSRC:+-k $$KSRC} $${KVERS:+-l $$KVERS} -i -u $$(pwd) lustre && \
502         popd && \
503         VER=$$(sed -ne '1s/^lustre (\(.*-[0-9][0-9]*\)).*$$/\1/p' debian/changelog) && \
504         if test "x@ENABLE_SERVER@" = "xyes"; then \
505                 DEB_SERVER_PKG="../lustre-resource-agents_$${VER}_*.deb"; \
506         fi; \
507         MULTILNDPKGS= ; \
508         if test "x@ENABLE_MULTIPLE_LNDS@" != "xno"; then \
509                 debian/repackage-multiple-lnds.sh $${KVERS} $${VER} ../lustre-*-modules-$${KVERS}_$${VER}_*.deb ; \
510                 MULTILNDPKGS="../lustre-lnet-module-*-$${KVERS}_$${VER}_*.deb"; \
511         fi; \
512         mkdir -p debs && \
513         mv ../lustre-dev_$${VER}_*.deb ../lustre-source_$${VER}_all.deb \
514            ../lustre-iokit_$${VER}_*.deb ../lustre-tests_$${VER}_*.deb \
515            ../lustre-*-utils_$${VER}_*.deb $${DEB_SERVER_PKG} $${MULTILNDPKGS} \
516            ../lustre_$${VER}.dsc ../lustre_$${VER}_*.changes \
517            ../lustre_$${VER}.tar.gz ../lustre-*-modules-$${KVERS}_$${VER}_*.deb \
518            ../lustre-*-dbgsym_$${VER}_*.ddeb ../lustre_$${VER}_*.buildinfo \
519            debs/
520
521 dkms-debs: undef.h debs_common
522         cp -v debian/changelog.in debian/changelog ; \
523         export SRC_GIT_HASH=$$(git log --oneline | head -1 | cut -d' ' -f1); \
524         lversion=$$(echo @VERSION@ | tr '_' '-'); \
525         cversion=$$(sed -ne '1s/^lustre (\(.*\)-[0-9][0-9]*).*$$/\1/p' debian/changelog); \
526         if [ "$$lversion" != "$$cversion" ]; then \
527                 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; \
528         fi; \
529         rm -rf debs; \
530         export DEB_BUILD_PROFILES="client"; \
531         export KERNEL_OBJ="$(LINUX_OBJ)"; \
532         export KERNEL_SRC="$(LINUX)"; \
533         echo "Enabled Build Profiles: $${DEB_BUILD_PROFILES}"; \
534         tmpprofiles=`tr ' ' ',' <<< $$DEB_BUILD_PROFILES`; \
535         echo "Kernel Source: $${KERNEL_SRC}"; \
536         echo "Kernel Object: $${KERNEL_OBJ}"; \
537         export BUILD_DKMS="true" && \
538         cp -v debian/control.main debian/control ; \
539         dpkg-buildpackage -us -uc -I.git -I\*.out[0-9]\* -I\*.swp -P$$tmpprofiles || { \
540                 rc=$${PIPESTATUS[0]}; \
541                 [ $${rc} -gt 1 ] && exit $${rc}; \
542                 exit 0; \
543         }; \
544         VER=$$(sed -ne '1s/^lustre (\(.*-[0-9][0-9]*\)).*$$/\1/p' debian/changelog) && \
545         mkdir -p debs && \
546         mv ../lustre-dev_$${VER}_*.deb ../lustre-source_$${VER}_all.deb \
547            ../lustre-iokit_$${VER}_*.deb ../lustre-tests_$${VER}_*.deb \
548            ../lustre-*-utils_$${VER}_*.deb \
549            ../lustre_$${VER}.dsc ../lustre_$${VER}_*.changes \
550            ../lustre_$${VER}.tar.gz ../lustre-*-modules-dkms_$${VER}_*.deb \
551            ../lustre-*-dbgsym_$${VER}_*.ddeb ../lustre_$${VER}_*.buildinfo \
552            debs/
553
554 EXTRA_DIST += debian/*
555
556 CSTK=/tmp/checkstack
557 CSTKO=/tmp/checkstack.orig
558
559 checkstack:
560         [ -f ${CSTK} -a ! -s ${CSTKO} ] && mv -f ${CSTK} ${CSTKO} || true
561         { for MOD in $$(find . -name "*.ko"); do                             \
562                 objdump -d $$MOD | perl contrib/scripts/checkstack.pl;       \
563           done } | grep -v " bug " | sort -nr | uniq > ${CSTK}
564         [ -f ${CSTKO} ] && ! diff -u ${CSTKO} ${CSTK} || head -n 30 ${CSTK}
565
566 checkstack-update:
567         [ -f ${CSTK} ] && mv -f ${CSTK} ${CSTKO}
568
569 checkstack-clean:
570         rm -f ${CSTK} ${CSTKO}