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