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