Whamcloud - gitweb
New release 2.15.64
[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                 export SYSTEMD_OPTIONS="--with-systemdsystemunitdir=@systemdsystemunitdir@"; \
375         fi; \
376         if test "x@ENABLE_PINGER@" = "xyes"; then \
377                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} pinger"; \
378         elif test "x@ENABLE_PINGER@" = "xno"; then \
379                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} nopinger"; \
380         fi; \
381         if test "x@ENABLE_CHECKSUM@" = "xyes"; then \
382                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} checksum"; \
383         elif test "x@ENABLE_CHECKSUM@" = "xno"; then \
384                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} nochecksum"; \
385         fi; \
386         if test "x@ENABLE_FLOCK@" = "xyes"; then \
387                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} flock"; \
388         elif test "x@ENABLE_FLOCK@" = "xno"; then \
389                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} noflock"; \
390         fi; \
391         if test "x@ENABLE_LRU_RESIZE@" = "xyes"; then \
392                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} lru-resize"; \
393         elif test "x@ENABLE_LRU_RESIZE@" = "xno"; then \
394                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} nolru-resize"; \
395         fi; \
396         if test "x@ENABLE_MINDF@" = "xyes"; then \
397                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} mindf"; \
398         elif test "x@ENABLE_MINDF@" = "xno"; then \
399                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} nomindf"; \
400         fi; \
401         if test "x@ENABLE_FAIL_ALLOC@" = "xyes"; then \
402                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} fail-alloc"; \
403         elif test "x@ENABLE_FAIL_ALLOC@" = "xno"; then \
404                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} nofail-alloc"; \
405         fi; \
406         if test "x@ENABLE_INVARIANTS@" = "xyes"; then \
407                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} invariants"; \
408         elif test "x@ENABLE_INVARIANTS@" = "xno"; then \
409                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} noinvariants"; \
410         fi; \
411         if test "x@ENABLE_LU_REF@" = "xyes"; then \
412                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} lu_ref"; \
413         elif test "x@ENABLE_LU_REF@" = "xno"; then \
414                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} nolu_ref"; \
415         fi; \
416         if test "x@ENABLE_PGSTAT_TRACK@" = "xyes"; then \
417                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} pgstate-track"; \
418         elif test "x@ENABLE_PGSTAT_TRACK@" = "xno"; then \
419                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} nopgstate-track"; \
420         fi; \
421         if test "x@ENABLE_LIBCFS_CDEBUG@" = "xyes"; then \
422                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} libcfs-cdebug"; \
423         elif test "x@ENABLE_LIBCFS_CDEBUG@" = "xno"; then \
424                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} nolibcfs-cdebug"; \
425         fi; \
426         if test "x@ENABLE_LIBCFS_TRACE@" = "xyes"; then \
427                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} libcfs-trace"; \
428         elif test "x@ENABLE_LIBCFS_TRACE@" = "xno"; then \
429                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} nolibcfs-trace"; \
430         fi; \
431         if test "x@ENABLE_LIBCFS_ASSERT@" = "xyes"; then \
432                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} libcfs-assert"; \
433         elif test "x@ENABLE_LIBCFS_ASSERT@" = "xno"; then \
434                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} nolibcfs-assert"; \
435         fi; \
436         if test "x@ENABLE_PANIC_DUMPLOG@" = "xyes"; then \
437                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} panic_dumplog"; \
438         elif test "x@ENABLE_PANIC_DUMPLOG@" = "xno"; then \
439                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} nopanic_dumplog"; \
440         fi; \
441         if test "x@ENABLE_READLINE@" = "xyes"; then \
442                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} readline"; \
443         elif test "x@ENABLE_READLINE@" = "xno"; then \
444                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} noreadline"; \
445         fi; \
446         if test "x@ENABLE_LIBPTHREAD@" = "xyes"; then \
447                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} libpthread"; \
448         elif test "x@ENABLE_LIBPTHREAD@" = "xno"; then \
449                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} nolibpthread"; \
450         fi; \
451         if test "x@ENABLE_BACKOFF@" = "xyes"; then \
452                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} backoff"; \
453         elif test "x@ENABLE_BACKOFF@" = "xno"; then \
454                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} nobackoff"; \
455         fi; \
456         if test "x@ENABLE_EFENCE@" = "xyes"; then \
457                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} efence"; \
458         elif test "x@ENABLE_EFENCE@" = "xno"; then \
459                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} noefence"; \
460         fi; \
461         if test "x@TESTS_FALSE@" = "x"; then \
462                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} notests"; \
463         fi; \
464         export KERNEL_OBJ="$(LINUX_OBJ)"; \
465         export KERNEL_SRC="$(LINUX)"; \
466         echo "Enabled Build Profiles: $${DEB_BUILD_PROFILES}"; \
467         echo "Kernel Source: $${KERNEL_SRC}"; \
468         echo "Kernel Object: $${KERNEL_OBJ}"; \
469         if test "x@ENABLEO2IB@" = "xno"; then \
470                 export IB_OPTIONS="--with-o2ib=no"; \
471         else \
472                 if test "x@ENABLEO2IB@" != "xyes" && \
473                    test -n "@O2IBPATH@"; then \
474                         export IB_OPTIONS="--with-o2ib=@O2IBPATH@"; \
475                 else \
476                         export IB_OPTIONS="--with-o2ib=yes"; \
477                 fi; \
478         fi; \
479         cp -v debian/control.main debian/control ; \
480         sed "s/_KVERS_/$(LINUXRELEASE)/g" debian/lustre-tests.install.in \
481                 > debian/lustre-tests.install; \
482         tmpprofiles=`tr ' ' ',' <<< $$DEB_BUILD_PROFILES`; \
483         dpkg-buildpackage -us -uc -I.git -I\*.out[0-9]\* -I\*.swp -P$$tmpprofiles || { \
484                 rc=$${PIPESTATUS[0]}; \
485                 cp $$debiantmp/control.main.bkp debian/control.main || true && \
486                 cp $$debiantmp/control.modules.in.bkp debian/control.modules.in || true && \
487                 [ $${rc} -gt 1 ] && exit $${rc}; \
488                 exit 0; \
489         }; \
490         cp $$debiantmp/control.main.bkp debian/control.main || true && \
491         cp $$debiantmp/control.modules.in.bkp debian/control.modules.in || true && \
492         cp -v debian/control.main debian/control || true ; \
493         export KPKG_DEST_DIR="$$(pwd)/.." && \
494         version=$$(sed -ne '1s/^lustre (\(.*\)).*$$/\1/p' debian/changelog) && \
495         rm -rf debian/tmp/modules-deb && \
496         mkdir debian/tmp/modules-deb && \
497         pushd debian/tmp/modules-deb && \
498         dpkg -x ../../../../lustre-source_$${version}_all.deb $$(pwd) && \
499         mkdir usr_src/ && \
500         tar -C usr_src/ -xjf usr/src/lustre-$${SRC_GIT_HASH}.tar.bz2 && \
501         chmod 755 usr_src/modules/lustre/debian/rules && \
502         mkdir -p usr_share_modass && \
503         ln -s /usr/share/modass/include/ usr_share_modass/ && \
504         ln -s /usr/share/modass/packages/ usr_share_modass/ && \
505         echo "lustre" > usr_share_modass/compliant.list && \
506         export MA_DIR=$$(pwd)/usr_share_modass && \
507         KVERS=$${KVERS:-$(LINUXRELEASE)} && \
508         export KSRC_TREE=$(LINUX) && \
509         KSRC=$${KSRC:-$(LINUX_OBJ)} && \
510         TARBALL=$$(realpath usr/src/lustre-$${SRC_GIT_HASH}.tar.bz2) \
511         m-a build $${KSRC:+-k $$KSRC} $${KVERS:+-l $$KVERS} -i -u $$(pwd) lustre && \
512         popd && \
513         VER=$$(sed -ne '1s/^lustre (\(.*-[0-9][0-9]*\)).*$$/\1/p' debian/changelog) && \
514         if test "x@ENABLE_SERVER@" = "xyes"; then \
515                 DEB_SERVER_PKG="../lustre-resource-agents_$${VER}_*.deb"; \
516         fi; \
517         MULTILNDPKGS= ; \
518         if test "x@ENABLE_MULTIPLE_LNDS@" != "xno"; then \
519                 debian/repackage-multiple-lnds.sh $${KVERS} $${VER} ../lustre-*-modules-$${KVERS}_$${VER}_*.deb ; \
520                 MULTILNDPKGS="../lustre-lnet-module-*-$${KVERS}_$${VER}_*.deb"; \
521         fi; \
522         mkdir -p debs && \
523         mv ../lustre-dev_$${VER}_*.deb ../lustre-source_$${VER}_all.deb \
524            ../lustre-iokit_$${VER}_*.deb ../lustre-tests_$${VER}_*.deb \
525            ../lustre-*-utils_$${VER}_*.deb $${DEB_SERVER_PKG} $${MULTILNDPKGS} \
526            ../lustre_$${VER}.dsc ../lustre_$${VER}_*.changes \
527            ../lustre_$${VER}.tar.gz ../lustre-*-modules-$${KVERS}_$${VER}_*.deb \
528            ../lustre-*-dbgsym_$${VER}_*.ddeb ../lustre_$${VER}_*.buildinfo \
529            debs/
530
531 dkms-debs: undef.h debs_common
532         cp -v debian/changelog.in debian/changelog ; \
533         export SRC_GIT_HASH=$$(git log --oneline | head -1 | cut -d' ' -f1); \
534         lversion=$$(echo @VERSION@ | tr '_' '-'); \
535         cversion=$$(sed -ne '1s/^lustre (\(.*\)-[0-9][0-9]*).*$$/\1/p' debian/changelog); \
536         if [ "$$lversion" != "$$cversion" ]; then \
537                 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; \
538         fi; \
539         rm -rf debs; \
540         export DEB_BUILD_PROFILES="client"; \
541         export KERNEL_OBJ="$(LINUX_OBJ)"; \
542         export KERNEL_SRC="$(LINUX)"; \
543         echo "Enabled Build Profiles: $${DEB_BUILD_PROFILES}"; \
544         tmpprofiles=`tr ' ' ',' <<< $$DEB_BUILD_PROFILES`; \
545         echo "Kernel Source: $${KERNEL_SRC}"; \
546         echo "Kernel Object: $${KERNEL_OBJ}"; \
547         export BUILD_DKMS="true" && \
548         cp -v debian/control.main debian/control ; \
549         dpkg-buildpackage -us -uc -I.git -I\*.out[0-9]\* -I\*.swp -P$$tmpprofiles || { \
550                 rc=$${PIPESTATUS[0]}; \
551                 [ $${rc} -gt 1 ] && exit $${rc}; \
552                 exit 0; \
553         }; \
554         VER=$$(sed -ne '1s/^lustre (\(.*-[0-9][0-9]*\)).*$$/\1/p' debian/changelog) && \
555         mkdir -p debs && \
556         mv ../lustre-dev_$${VER}_*.deb ../lustre-source_$${VER}_all.deb \
557            ../lustre-iokit_$${VER}_*.deb ../lustre-tests_$${VER}_*.deb \
558            ../lustre-*-utils_$${VER}_*.deb \
559            ../lustre_$${VER}.dsc ../lustre_$${VER}_*.changes \
560            ../lustre_$${VER}.tar.gz ../lustre-*-modules-dkms_$${VER}_*.deb \
561            ../lustre-*-dbgsym_$${VER}_*.ddeb ../lustre_$${VER}_*.buildinfo \
562            debs/
563
564 EXTRA_DIST += debian/*
565
566 CSTK=/tmp/checkstack
567 CSTKO=/tmp/checkstack.orig
568
569 checkstack:
570         [ -f ${CSTK} -a ! -s ${CSTKO} ] && mv -f ${CSTK} ${CSTKO} || true
571         { for MOD in $$(find . -name "*.ko"); do                             \
572                 objdump -d $$MOD | perl contrib/scripts/checkstack.pl;       \
573           done } | grep -v " bug " | sort -nr | uniq > ${CSTK}
574         [ -f ${CSTKO} ] && ! diff -u ${CSTKO} ${CSTK} || head -n 30 ${CSTK}
575
576 checkstack-update:
577         [ -f ${CSTK} ] && mv -f ${CSTK} ${CSTKO}
578
579 checkstack-clean:
580         rm -f ${CSTK} ${CSTKO}