2 # SPDX-License-Identifier: NOASSERTION
5 # This file is part of Lustre, http://www.lustre.org/
11 # Copying and modification is unlimited, provided that the modified
12 # version is marked as being modified.
13 # (This version has been modified from the original)
15 # Created 2009 by Brian J. Murrell based on work by
16 # Alastair McKinstry, <alastair.mckinstry@ichec.ie>, <mckinstry@debian.org>
17 # Patrick Winnertz, and the pkg-lustre Debian maintainers
20 # Uncomment this to turn on verbose mode.
23 DEB_BUILD_GNU_SYSTEM = $(shell dpkg-architecture -qDEB_BUILD_GNU_SYSTEM)
24 DEB_BUILD_GNU_CPU = $(shell dpkg-architecture -qDEB_BUILD_GNU_CPU)
27 # whether to use module-assistant to build the kernel modules or not
30 # Whether to build the DKMS packages
33 ifeq ($(BUILD_DKMS),true)
34 DKMS_TARGET = binary-$(DKMS_PKG)
40 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
46 # This is the debhelper compatibility version to use.
49 # Module-assistant stuff
50 ifneq (,$(findstring server,$(DEB_BUILD_PROFILES)))
51 PACKAGE=lustre-server-modules
53 PACKAGE=lustre-client-modules
55 MA_DIR ?= /usr/share/modass
56 -include $(MA_DIR)/include/generic.make
57 -include $(MA_DIR)/include/common-rules.make
59 ARCH=$(shell dpkg --print-architecture)
62 # This is the Lustre version
63 VERSION=$(shell sed -n -e '1s/.*(\(.*\)) .*/\1/p' debian/changelog)
64 UPVERSION=$(shell echo $(VERSION) | sed -e 's/-[^-]*$$//')
66 # KVER is set to LINUXRELEASE being by autoconf which is either
67 # $(uname -r) or the version of the source specified by the user
70 # KVERS, KSRC are the kernel version and source to use when building lustre
71 # Will be the default when building lustre-{server,client}-utils, etc but whatever module-assistant
72 # supplied when building modules
76 EXTRA_OPTIONS?=$(IB_OPTIONS)
78 # Packages provided for both client and server builds
79 IOKIT_PKG=lustre-iokit
80 TESTS_PKG=lustre-tests
82 SOURCE_PKG=lustre-source
84 # Packages that are only built for server OR client builds
85 # The difference is that server build contain more modules & utils
86 ifneq (,$(findstring server,$(DEB_BUILD_PROFILES)))
87 UTILS_PKG=lustre-server-utils
88 MODS_PKG=lustre-server-modules
89 RESOURCE_PKG=lustre-resource-agents
90 RESOURCE_TARGET=binary-$(RESOURCE_PKG)
93 UTILS_PKG=lustre-client-utils
94 MODS_PKG=lustre-client-modules
97 DKMS_PKG=lustre-client-modules-dkms
101 #BUILDDIR=debian/build
103 # I'm afraid we seem to have broken the BUILDDIR concept in Lustre's
108 AVAIL_CPUS := $(shell getconf _NPROCESSORS_ONLN 2>/dev/null || echo 1)
109 ifneq ($(AVAIL_CPUS),1)
110 PMAKEARGS := -j $(AVAIL_CPUS)
113 autogen: autogen-stamp
114 autogen-stamp: patch-stamp
115 # see if any patches requires us to run autogen
116 # (for a distribution release tarball, it is expected that if
117 # downstream adds any patches that requires autogen.sh to be
118 # run, a patch will be added by downstream to install the
119 # needed autogen.sh scripts
120 # see https://bugzilla.lustre.org/attachment.cgi?id=27156
122 if grep -e "^--- .*\/autoconf\/" \
123 -e "^--- .*\/autoMakefile\.am" \
124 -e "^--- .*\/Makefile\.am" \
125 -e "^--- .*\/configure\.ac" \
126 -e "^--- .*\/configure\.in" \
127 debian/patches/*; then \
128 if [ ! -f build/autogen.sh ]; then \
129 echo "You have patches which require autogen.sh to be run, but it doesn't exist"; \
130 echo "Please see https://bugzilla.lustre.org/attachment.cgi?id=27156"; \
133 cp /usr/share/misc/config.sub config.sub; \
134 cp /usr/share/misc/config.sub ldiskfs/config.sub; \
135 cp /usr/share/misc/config.guess config.guess; \
136 cp /usr/share/misc/config.guess ldiskfs/config.guess; \
137 bash build/autogen.sh; \
141 # This section configures the lustre-utilities packages.
143 # Both client and server builds are quite similar, as the utilities build
144 # must create the modules too, to produce the "osd_<fstype>.so" libraries.
146 # The main difference is that the utilities build does not archive the
147 # modules, whereas the modules build omits the utilities, to create two
148 # neatly separated debian files.
150 # Note: KERNEL_SRC, KERNEL_OBJ, ZFS_SRC and SPL_SRC need to be set from the
151 # outside. This is done by "make debs". As such, invoking "debuild" or such
152 # direct debian build tools will lead to a client-only build.
153 configure: configure-stamp
154 configure-stamp: autogen-stamp debian/control.main debian/control.modules.in
156 # touch files to same date, to avoid auto*
157 find . -type f -print0 | xargs -0 touch -r COPYING; \
158 if [ "$(BUILDDIR)" != "." ]; then \
159 mkdir -p $(BUILDDIR)/build $(BUILDDIR)/lustre/contrib; \
160 cp build/Makefile $(BUILDDIR)/build/; \
162 # Determine flags that are different between server/client module builds
163 echo "Enabled Build Profiles: $${DEB_BUILD_PROFILES}"
164 if echo "$${DEB_BUILD_PROFILES}" | grep -q "server"; then \
165 export EXTRAFLAGS="--enable-server"; \
166 if echo "$${DEB_BUILD_PROFILES}" | grep -q "systemd"; then \
167 cp debian/lustre-server-utils.install.in \
168 debian/lustre-server-utils.install; \
170 sed /systemd/d debian/lustre-server-utils.install.in \
171 > debian/lustre-server-utils.install; \
174 export EXTRAFLAGS="--disable-server"; \
175 if echo "$${DEB_BUILD_PROFILES}" | grep -q "systemd"; then \
176 cp debian/lustre-client-utils.install.in \
177 debian/lustre-client-utils.install; \
179 sed /systemd/d debian/lustre-client-utils.install.in \
180 > debian/lustre-client-utils.install; \
183 if echo "$${DEB_BUILD_PROFILES}" | grep -q "zfs"; then \
184 export EXTRAFLAGS="$${EXTRAFLAGS} --with-zfs=$${ZFS_SRC} --with-spl=$${SPL_SRC}"; \
186 export EXTRAFLAGS="$${EXTRAFLAGS} --without-zfs" ; \
188 if echo "$${DEB_BUILD_PROFILES}" | grep -q "ldiskfs"; then \
189 export EXTRAFLAGS="$${EXTRAFLAGS} \
190 --enable-ldiskfs --enable-quilt"; \
192 export EXTRAFLAGS="$${EXTRAFLAGS} --disable-ldiskfs"; \
194 if echo "$${DEB_BUILD_PROFILES}" | grep -q "multiple-lnds"; then \
195 export EXTRAFLAGS="$${EXTRAFLAGS} --enable-multiple-lnds"; \
197 if echo "$${DEB_BUILD_PROFILES}" | grep -q "ext_o2ib"; then \
198 export EXTRAFLAGS="$${EXTRAFLAGS} --with-o2ib=$${O2IB_SRC}"; \
199 elif echo "$${DEB_BUILD_PROFILES}" | grep -q "int_o2ib"; then \
200 export EXTRAFLAGS="$${EXTRAFLAGS} --with-o2ib=yes"; \
202 export EXTRAFLAGS="$${EXTRAFLAGS} --with-o2ib=no"; \
204 if echo "$${DEB_BUILD_PROFILES}" | grep -q "gnilnd"; then \
205 export EXTRAFLAGS="$${EXTRAFLAGS} --enable-gni"; \
207 if echo "$${DEB_BUILD_PROFILES}" | grep -q "kfilnd"; then \
208 export EXTRAFLAGS="$${EXTRAFLAGS} --with-kfi=/usr/src/kfabric"; \
210 options="gss crypto pinger checksum flock lru-resize"; \
211 options="$${options} mindf fail-alloc invariants lu_ref pgstate-track"; \
212 options="$${options} libcfs-cdebug libcfs-trace libcfs-assert"; \
213 options="$${options} panic_dumplog readline libpthread"; \
214 options="$${options} backoff gni efence"; \
215 for option in $${options}; do \
216 if echo "$${DEB_BUILD_PROFILES}" | grep -qw "$${option}"; then \
217 export EXTRAFLAGS="$${EXTRAFLAGS} --enable-$${option}"; \
218 elif echo "$${DEB_BUILD_PROFILES}" | grep -qw "no$${option}"; then \
219 export EXTRAFLAGS="$${EXTRAFLAGS} --disable-$${option}"; \
222 if [ -f "$${CONFIG_CACHE_FILE}" ]; then \
223 export TMP_CACHE_FILE=$$(mktemp); \
224 sed -e "/ac_cv_env/d" \
225 -e "/am_cv_CC_dependencies_compiler_type/d" \
226 -e "/lb_cv_mpi_tests/d" \
227 "$${CONFIG_CACHE_FILE}" > $${TMP_CACHE_FILE}; \
228 export EXTRAFLAGS="$${EXTRAFLAGS} --cache-file=$${TMP_CACHE_FILE}"; \
230 echo "Final value of EXTRAFLAGS: $${EXTRAFLAGS}"; \
231 ( cd $(BUILDDIR) && \
232 $(SRCDIR)/configure --disable-dependency-tracking \
233 --with-linux=$${KERNEL_SRC} \
234 --with-linux-obj=$${KERNEL_OBJ} \
241 build-arch build-indep: build
244 build-stamp: patch-stamp configure-stamp
246 $(MAKE) -C $(BUILDDIR) $(PMAKEARGS)
247 $(MAKE) -C $(BUILDDIR) DESTDIR=$(TOP_DIR)/debian/tmp install
248 # jump our lustre-[client|server]-modules into the control file if not using m-a
249 if ! $(USE_MA); then \
250 (cat debian/control.main; sed -e '1,/^$$/d' -e "s/_KVERS_/$(KVER)/g" < debian/control.modules.in) > debian/control; \
251 for file in debian/*_KVERS_*; do \
252 newfile=$$(echo $$file | sed -e "s/_KVERS_/$(KVER)/g"); \
253 cp $$file $$newfile; \
258 # let's try and operate as close as the user would and not build modules
260 # instead we will build the modules with m-a in the "make debs" target
261 # binary-arch: binary-$(UTILS_PKG) binary-$(TESTS_PKG) binary-$(DEV_PKG) \
262 # binary-$(MODS_PKG) binary-kern-mods
263 binary-arch: binary-$(UTILS_PKG) binary-$(DEV_PKG) \
264 binary-$(IOKIT_PKG) binary-$(TESTS_PKG) \
267 binary-indep: binary-$(SOURCE_PKG) $(DKMS_TARGET)
269 binary: binary-indep binary-arch
271 binary-$(UTILS_PKG): build-stamp
274 dh_installdirs -p $(UTILS_PKG)
275 dh_installdocs -p $(UTILS_PKG)
276 dh_installman -p $(UTILS_PKG)
277 dh_install -p $(UTILS_PKG)
278 rm -rf debian/$(UTILS_PKG)/usr/bin/iokit-* \
279 debian/$(UTILS_PKG)/usr/bin/*-survey \
280 debian/$(UTILS_PKG)/usr/bin/mcreate \
281 debian/$(UTILS_PKG)/usr/bin/statx \
282 debian/$(UTILS_PKG)/usr/sbin/wirecheck \
283 debian/$(UTILS_PKG)/usr/sbin/wiretest
284 dh_makeshlibs -p $(UTILS_PKG)
285 dh_installexamples -p $(UTILS_PKG)
286 dh_installchangelogs -p $(UTILS_PKG) lustre/ChangeLog
287 dh_compress -p $(UTILS_PKG)
288 dh_strip -p $(UTILS_PKG)
289 dh_installdeb -p $(UTILS_PKG)
290 dh_fixperms -p $(UTILS_PKG)
291 dh_gencontrol -p $(UTILS_PKG)
292 dh_md5sums -p $(UTILS_PKG)
293 dh_builddeb -p $(UTILS_PKG)
295 binary-$(RESOURCE_PKG): build-stamp
298 dh_installdirs -p $(RESOURCE_PKG)
299 dh_installdocs -p $(RESOURCE_PKG)
300 dh_installman -p $(RESOURCE_PKG)
301 dh_install -p $(RESOURCE_PKG)
302 dh_makeshlibs -p $(RESOURCE_PKG)
303 dh_installexamples -p $(RESOURCE_PKG)
304 dh_installchangelogs -p $(RESOURCE_PKG) lustre/ChangeLog
305 dh_compress -p $(RESOURCE_PKG)
306 dh_strip -p $(RESOURCE_PKG)
307 dh_installdeb -p $(RESOURCE_PKG)
308 dh_fixperms -p $(RESOURCE_PKG)
309 dh_gencontrol -p $(RESOURCE_PKG)
310 dh_md5sums -p $(RESOURCE_PKG)
311 dh_builddeb -p $(RESOURCE_PKG)
313 binary-$(IOKIT_PKG): build-stamp
316 dh_installdirs -p $(IOKIT_PKG)
317 dh_installdocs -p $(IOKIT_PKG)
318 dh_installman -p $(IOKIT_PKG)
319 dh_install -p $(IOKIT_PKG)
320 rm -rf debian/$(IOKIT_PKG)/usr/bin/lustre_req_history \
321 debian/$(IOKIT_PKG)/usr/bin/*ll*stat \
322 debian/$(IOKIT_PKG)/usr/bin/lfs-*
323 dh_makeshlibs -p $(IOKIT_PKG)
324 dh_installexamples -p $(IOKIT_PKG)
325 dh_installchangelogs -p $(IOKIT_PKG) lustre/ChangeLog
326 dh_compress -p $(IOKIT_PKG)
327 dh_strip -p $(IOKIT_PKG)
328 dh_installdeb -p $(IOKIT_PKG)
329 dh_fixperms -p $(IOKIT_PKG)
330 dh_gencontrol -p $(IOKIT_PKG)
331 dh_md5sums -p $(IOKIT_PKG)
332 dh_builddeb -p $(IOKIT_PKG)
334 binary-$(TESTS_PKG): build-stamp
337 dh_installdirs -p $(TESTS_PKG)
338 dh_installdocs -p $(TESTS_PKG)
339 dh_installman -p $(TESTS_PKG)
340 dh_install -p $(TESTS_PKG)
341 dh_makeshlibs -p $(TESTS_PKG)
342 dh_installexamples -p $(TESTS_PKG)
343 dh_installchangelogs -p $(TESTS_PKG) lustre/ChangeLog
344 dh_compress -p $(TESTS_PKG)
345 dh_strip -p $(TESTS_PKG)
346 dh_installdeb -p $(TESTS_PKG)
347 dh_fixperms -p $(TESTS_PKG)
348 dh_gencontrol -p $(TESTS_PKG)
349 dh_md5sums -p $(TESTS_PKG)
350 dh_builddeb -p $(TESTS_PKG)
352 binary-$(DEV_PKG): build-stamp
355 dh_installdirs -p $(DEV_PKG)
356 dh_install -p $(DEV_PKG)
357 dh_installdocs -p $(DEV_PKG)
358 dh_installchangelogs -p $(DEV_PKG) lustre/ChangeLog
359 dh_compress -p $(DEV_PKG)
360 dh_installdeb -p $(DEV_PKG)
361 dh_fixperms -p $(DEV_PKG)
362 dh_gencontrol -p $(DEV_PKG)
363 dh_md5sums -p $(DEV_PKG)
364 dh_builddeb -p $(DEV_PKG)
366 binary-$(SOURCE_PKG): build-stamp
370 dh_installdirs -p $(SOURCE_PKG) usr/src/modules/lustre/debian
371 rsync -av --exclude='debian/$(SOURCE_PKG)/*' \
373 . debian/$(SOURCE_PKG)/usr/src/modules/lustre
374 # Remove FULLCLEAN setting
375 rm debian/$(SOURCE_PKG)/usr/src/modules/lustre/debian/rules
376 cp -v debian/rules debian/$(SOURCE_PKG)/usr/src/modules/lustre/debian/rules
377 sed -i -e 's/FULLCLEAN=full-clean/FULLCLEAN=/' debian/$(SOURCE_PKG)/usr/src/modules/lustre/debian/rules
379 rm -rf debian/$(SOURCE_PKG)/usr/src/modules/lustre/debian/patched \
380 debian/$(SOURCE_PKG)/usr/src/modules/lustre/debian/patches/*
381 $(MAKE) -C debian/$(SOURCE_PKG)/usr/src/modules/lustre -f debian/rules clean
382 # Create the module-source tarball.
383 cd debian/$(SOURCE_PKG)/usr/src && tar --exclude-vcs -jcf lustre-$${SRC_GIT_HASH}.tar.bz2 modules
384 rm -rf debian/$(SOURCE_PKG)/usr/src/modules
385 dh_install -p$(SOURCE_PKG)
386 dh_installchangelogs -p $(SOURCE_PKG) lustre/ChangeLog
387 dh_installdocs -p $(SOURCE_PKG)
388 dh_link -p $(SOURCE_PKG) /usr/share/modass/packages/default.sh /usr/share/modass/overrides/lustre-source
389 dh_compress -p $(SOURCE_PKG)
390 dh_installdeb -p $(SOURCE_PKG)
391 dh_fixperms -p $(SOURCE_PKG)
392 dh_gencontrol -p $(SOURCE_PKG)
393 dh_md5sums -p $(SOURCE_PKG)
394 dh_builddeb -p $(SOURCE_PKG)
396 binary-$(DKMS_PKG): build-stamp
399 # Create /usr/src/lustre-client-modules-<version>
400 dh_installdirs -p $(DKMS_PKG) usr/src/lustre-client-modules-$(UPVERSION)
402 rsync -av --exclude='debian/$(DKMS_PKG)/*' --exclude='.git/' \
404 . debian/$(DKMS_PKG)/usr/src/lustre-client-modules-$(UPVERSION)
406 $(MAKE) -C debian/$(DKMS_PKG)/usr/src/lustre-client-modules-$(UPVERSION) -f debian/rules clean
408 # Put the DKMS configuration file in place
409 sed -e 's/[@]UPVERSION[@]/$(UPVERSION)/' debian/dkms.conf.in > debian/$(DKMS_PKG)/usr/src/lustre-client-modules-$(UPVERSION)/dkms.conf
410 dh_install -p $(DKMS_PKG)
411 dh_installchangelogs -p $(DKMS_PKG) lustre/ChangeLog
412 dh_installdocs -p $(DKMS_PKG)
413 dh_compress -p $(DKMS_PKG)
414 dh_installdeb -p $(DKMS_PKG)
415 dh_strip -p $(DKMS_PKG)
416 dh_fixperms -p $(DKMS_PKG)
417 dh_gencontrol -p $(DKMS_PKG)
418 dh_md5sums -p $(DKMS_PKG)
419 dh_builddeb -p $(DKMS_PKG)
421 # if only we could use m-a for this, but this stupid "compliant.list"
422 # thing fouls that up
424 # Build client or server modules
425 mkdir -p debian/m-a_root/usr_src/modules
426 ln -s ../../../../ debian/m-a_root/usr_src/modules/lustre
427 m-a -t -u debian/m-a_root/ -d -v -k $(KSRC) build lustre
428 mv -f debian/m-a_root/*.deb ..
430 # an alternative (to module-assistant) method of building the kernel modules
431 binary-$(MODS_PKG): build-stamp
432 if ! $(USE_MA); then \
433 cp debian/$(MODS_PKG).install debian/$(MODS_PKG)-$(KVER).install ; \
436 dh_installdirs -p $(MODS_PKG)-$(KVER); \
437 dh_installdocs -p $(MODS_PKG)-$(KVER); \
438 dh_install -p $(MODS_PKG)-$(KVER); \
439 dh_makeshlibs -p $(MODS_PKG)-$(KVER); \
440 dh_installchangelogs -p $(MODS_PKG)-$(KVER) lustre/ChangeLog; \
441 dh_compress -p $(MODS_PKG)-$(KVER); \
442 dh_installdeb -p $(MODS_PKG)-$(KVER); \
443 dh_strip -p $(MODS_PKG)-$(KVER); \
444 dh_fixperms -p $(MODS_PKG)-$(KVER); \
445 dh_gencontrol -p $(MODS_PKG)-$(KVER); \
446 dh_md5sums -p $(MODS_PKG)-$(KVER); \
447 dh_builddeb -p $(MODS_PKG)-$(KVER); \
452 ### For module-assistant
455 # the kdist_clean target is called by make-kpkg modules_clean and from
456 # kdist* rules. It is responsible for cleaning up any changes that have
457 # been made by the other kdist_commands (except for the .deb files created)
460 # can't dh_clean here or we remove the build artifacts for the other packages
463 #-$(MAKE) $(MFLAGS) -f debian/rules clean
464 # put the userspace tools' control file back
465 cp debian/control.main debian/control
468 # module assistant calculates all needed things for us and sets
469 # # following variables:
470 # # KSRC (kernel source directory), KVERS (kernel version string), KDREV
471 # # (revision of the Debian kernel-image package), CC (the correct
472 # # compiler), VERSION (the final package version string), PKGNAME (full
473 # # package name with KVERS included), DEB_DESTDIR (path to store DEBs)
475 # # The kdist_configure target is called by make-kpkg modules_config and
476 # # by kdist* rules by dependency. It should configure the module so it is
477 # # ready for compilation (mostly useful for calling configure).
478 # # prep-deb-files from module-assistant creates the neccessary debian/
479 kdist_config: prep-deb-files patch-stamp
480 # Check build dependencies again, needs to be done since we just
481 # replaced the control file.
483 # Prepare the kernel to lustres' liking
484 # as non-root, we won't have permission for this
485 #-$(MAKE) -C $(KSRC) prepare scripts
486 # touch files to same date, to avoid auto*
487 find . -type f -print0 | xargs -0 touch -r COPYING \;
488 # Determine flags that are different between server/client module builds
489 # Note: It doesn't seem possible to *only* build modules.
490 echo "Enabled Build Profiles: $${DEB_BUILD_PROFILES}"
491 if echo "$${DEB_BUILD_PROFILES}" | grep -q "server"; then \
492 export EXTRAFLAGS="--enable-server"; \
494 export EXTRAFLAGS="--disable-server"; \
496 if echo "$${DEB_BUILD_PROFILES}" | grep -q "zfs"; then \
497 export EXTRAFLAGS="$${EXTRAFLAGS} --with-zfs=$${ZFS_SRC} --with-spl=$${SPL_SRC}"; \
499 export EXTRAFLAGS="$${EXTRAFLAGS} --without-zfs" ; \
501 if echo "$${DEB_BUILD_PROFILES}" | grep -q "ldiskfs"; then \
502 export EXTRAFLAGS="$${EXTRAFLAGS} \
503 --enable-ldiskfs --enable-quilt"; \
505 export EXTRAFLAGS="$${EXTRAFLAGS} \
506 --disable-ldiskfs --disable-quilt"; \
508 if echo "$${DEB_BUILD_PROFILES}" | grep -q "multiple-lnds"; then \
509 export EXTRAFLAGS="$${EXTRAFLAGS} --enable-multiple-lnds"; \
511 if echo "$${DEB_BUILD_PROFILES}" | grep -q "ext_o2ib"; then \
512 export EXTRAFLAGS="$${EXTRAFLAGS} --with-o2ib=$${O2IB_SRC}"; \
513 elif echo "$${DEB_BUILD_PROFILES}" | grep -q "int_o2ib"; then \
514 export EXTRAFLAGS="$${EXTRAFLAGS} --with-o2ib=yes"; \
516 export EXTRAFLAGS="$${EXTRAFLAGS} --with-o2ib=no"; \
518 if echo "$${DEB_BUILD_PROFILES}" | grep -q "gnilnd"; then \
519 export EXTRAFLAGS="$${EXTRAFLAGS} --enable-gni"; \
521 if echo "$${DEB_BUILD_PROFILES}" | grep -q "kfilnd"; then \
522 export EXTRAFLAGS="$${EXTRAFLAGS} --with-kfi=/usr/src/kfabric"; \
524 options="gss crypto pinger checksum flock lru-resize"; \
525 options="$${options} mindf fail-alloc invariants lu_ref pgstate-track"; \
526 options="$${options} libcfs-cdebug libcfs-trace libcfs-assert"; \
527 options="$${options} panic_dumplog readline libpthread"; \
528 options="$${options} backoff gni efence"; \
529 for option in $${options}; do \
530 if echo "$${DEB_BUILD_PROFILES}" | grep -qw "$${option}"; then \
531 export EXTRAFLAGS="$${EXTRAFLAGS} --enable-$${option}"; \
532 elif echo "$${DEB_BUILD_PROFILES}" | grep -qw "no$${option}"; then \
533 export EXTRAFLAGS="$${EXTRAFLAGS} --disable-$${option}"; \
536 if [ -f "$${CONFIG_CACHE_FILE}" ]; then \
537 export TMP_CACHE_FILE=$$(mktemp --tmpdir newconfig-XXXXXXXX.cache); \
538 sed -e "/ac_cv_env/d" \
539 -e "/am_cv_CC_dependencies_compiler_type/d" \
540 -e "/lb_cv_mpi_tests/d" \
541 "$${CONFIG_CACHE_FILE}" > $${TMP_CACHE_FILE}; \
542 export EXTRAFLAGS="$${EXTRAFLAGS} --cache-file=$${TMP_CACHE_FILE}"; \
544 echo "Final value of EXTRAFLAGS: $${EXTRAFLAGS}"; \
545 ./configure --with-linux=$(KSRC_TREE) \
546 --with-linux-obj=$(KSRC) \
547 --disable-dependency-tracking \
552 --with-kmp-moddir=updates/kernel \
557 kdist_configure: kdist_config
559 # the binary-modules rule is invoked by module-assistant while processing the
560 # kdist* targets. It is called by module-assistant or make-kpkg and *not*
561 # during a normal build
562 binary-modules: prep-deb-files
566 $(MAKE) install DESTDIR=$(CURDIR)/debian/$(PKGNAME)
567 # Remove stuff that doesn't belong (no module-only target)
568 cd $(CURDIR)/debian/$(PKGNAME) && rm -rf usr/bin usr/sbin usr/lib usr/share usr/include/lustre lib/systemd sbin etc
569 dh_installdocs -p$(PKGNAME)
570 dh_installchangelogs -p$(PKGNAME)
571 dh_installmodules -p $(PKGNAME)
572 dh_compress -p $(PKGNAME)
573 dh_fixperms -p $(PKGNAME)
574 sed "s/depmod -a/depmod -a $(KVERS)/" $(CURDIR)/debian/postinst > $(CURDIR)/debian/$(PKGNAME).postinst
575 sed "s/depmod -a/depmod -a $(KVERS)/" $(CURDIR)/debian/postrm > $(CURDIR)/debian/$(PKGNAME).postrm
576 chmod +x $(CURDIR)/debian/$(PKGNAME).postinst $(CURDIR)/debian/$(PKGNAME).postrm
577 dh_installdeb -p $(PKGNAME)
578 dh_gencontrol -- -v$(VERSION)
579 dh_md5sums -p $(PKGNAME)
580 dh_builddeb --destdir=$(DEB_DESTDIR) -p $(PKGNAME)
581 dh_prep -p $(PKGNAME)
586 dpatch deapply-all -v
588 rm -rf debian/substvars debian/*.bak debian/*~ *~ *-stamp
589 ls -d debian/lustre-*-modules-* | grep -v _KVERS_ | grep -v dkms | xargs rm -f || true
590 # only remove this if the clean was not called from kdist_clean
591 if [ "$$MA_SOURCE_PKG" = "" ]; then \
592 rm -rf debian/m-a_root; \
595 # make sure we have at least a basic control in place (see build-stamp)
597 cp debian/control.main debian/control
605 dpatch deapply-all -v
606 rm -rf debian/patched patch-stamp
608 .PHONY: binary-arch clean source diff binary binary-indep binary-arch install configure