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