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