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