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