Whamcloud - gitweb
LU-11469 lnet: fix "debug recovery" output
[fs/lustre-release.git] / debian / rules
index 237904a..eeb32e0 100755 (executable)
@@ -17,6 +17,15 @@ DEB_BUILD_GNU_CPU = $(shell dpkg-architecture -qDEB_BUILD_GNU_CPU)
 # whether to use module-assistant to build the kernel modules or not
 USE_MA = true
 
+# Whether to build the DKMS packages
+BUILD_DKMS ?= false
+
+ifeq ($(BUILD_DKMS),true)
+       DKMS_TARGET = binary-$(DKMS_PKG)
+else
+       DKMS_TARGET =
+endif
+
 CFLAGS = -Wall -g
 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
         CFLAGS += -O0
@@ -47,7 +56,7 @@ TOP_DIR:=$(shell pwd)
 
 # This is the Lustre version
 VERSION=$(shell sed -n -e '1s/.*(\(.*\)) .*/\1/p' debian/changelog)
-UPVERSION=$(shell echo $VERSION | sed -e 's/-[^-]*$$//')
+UPVERSION=$(shell echo $(VERSION) | sed -e 's/-[^-]*$$//')
 
 # KVER is set to LINUXRELEASE being by autoconf which is either
 # $(uname -r) or the version of the source specified by the user
@@ -59,7 +68,7 @@ KVER?=$(LINUXRELEASE)
 KVERS?=$(KVER)
 KSRC?=$(LINUX_OBJ)
 KSRC_TREE?=$(LINUX)
-IB_OPTIONS?=""
+EXTRA_OPTIONS?=$(IB_OPTIONS)
 
 # Packages provided for both client and server builds
 IOKIT_PKG=lustre-iokit
@@ -72,9 +81,15 @@ SOURCE_PKG=lustre-source
 ifneq (,$(findstring server,$(DEB_BUILD_PROFILES)))
        UTILS_PKG=lustre-server-utils
        MODS_PKG=lustre-server-modules
+       RESOURCE_PKG=lustre-resource-agents
+       RESOURCE_TARGET=binary-$(RESOURCE_PKG)
+       DKMS_PKG=
 else
        UTILS_PKG=lustre-client-utils
        MODS_PKG=lustre-client-modules
+       RESOURCE_TARGET=
+       RESOURCE_PKG=
+       DKMS_PKG=lustre-client-modules-dkms
 endif
 
 #Build dir
@@ -191,9 +206,10 @@ build-stamp: patch-stamp configure-stamp
 # binary-arch: binary-$(UTILS_PKG) binary-$(TESTS_PKG) binary-$(DEV_PKG) \
 # binary-$(MODS_PKG) binary-kern-mods
 binary-arch: binary-$(UTILS_PKG) binary-$(DEV_PKG) \
-            binary-$(IOKIT_PKG) binary-$(TESTS_PKG)
+            binary-$(IOKIT_PKG) binary-$(TESTS_PKG) \
+            $(RESOURCE_TARGET)
 
-binary-indep: binary-$(SOURCE_PKG)
+binary-indep: binary-$(SOURCE_PKG) $(DKMS_TARGET)
 
 binary: binary-indep binary-arch
 
@@ -221,6 +237,24 @@ binary-$(UTILS_PKG): build-stamp
        dh_md5sums -p $(UTILS_PKG)
        dh_builddeb -p $(UTILS_PKG)
 
+binary-$(RESOURCE_PKG): build-stamp
+       dh_testdir
+       dh_testroot
+       dh_installdirs -p $(RESOURCE_PKG)
+       dh_installdocs -p  $(RESOURCE_PKG)
+       dh_installman -p $(RESOURCE_PKG)
+       dh_install -p $(RESOURCE_PKG)
+       dh_makeshlibs -p $(RESOURCE_PKG)
+       dh_installexamples -p $(RESOURCE_PKG)
+       dh_installchangelogs -p $(RESOURCE_PKG) lustre/ChangeLog
+       dh_compress -p $(RESOURCE_PKG)
+       dh_strip -p $(RESOURCE_PKG)
+       dh_installdeb -p $(RESOURCE_PKG)
+       dh_fixperms -p $(RESOURCE_PKG)
+       dh_gencontrol -p $(RESOURCE_PKG)
+       dh_md5sums -p $(RESOURCE_PKG)
+       dh_builddeb -p $(RESOURCE_PKG)
+
 binary-$(IOKIT_PKG): build-stamp
        dh_testdir
        dh_testroot
@@ -303,6 +337,31 @@ binary-$(SOURCE_PKG): build-stamp
        dh_md5sums -p $(SOURCE_PKG)
        dh_builddeb -p $(SOURCE_PKG)
 
+binary-$(DKMS_PKG): build-stamp
+       dh_testdir
+       dh_testroot
+       # Create /usr/src/lustre-client-modules-<version>
+       dh_installdirs -p $(DKMS_PKG) usr/src/lustre-client-modules-$(UPVERSION)
+       # Copy the source
+       rsync -av --exclude='debian/$(DKMS_PKG)/*' --exclude='.git/' \
+               --link-dest=$(PWD) \
+               . debian/$(DKMS_PKG)/usr/src/lustre-client-modules-$(UPVERSION)
+       # Clean it up
+       $(MAKE) -C debian/$(DKMS_PKG)/usr/src/lustre-client-modules-$(UPVERSION) -f debian/rules clean
+
+       # Put the DKMS configuration file in place
+       sed -e 's/[@]UPVERSION[@]/$(UPVERSION)/' debian/dkms.conf.in > debian/$(DKMS_PKG)/usr/src/lustre-client-modules-$(UPVERSION)/dkms.conf
+       dh_install -p $(DKMS_PKG)
+       dh_installchangelogs -p $(DKMS_PKG) lustre/ChangeLog
+       dh_installdocs -p $(DKMS_PKG)
+       dh_compress -p $(DKMS_PKG)
+       dh_installdeb -p $(DKMS_PKG)
+       dh_strip -p $(DKMS_PKG)
+       dh_fixperms -p $(DKMS_PKG)
+       dh_gencontrol -p $(DKMS_PKG)
+       dh_md5sums -p $(DKMS_PKG)
+       dh_builddeb -p $(DKMS_PKG)
+
 # if only we could use m-a for this, but this stupid "compliant.list"
 # thing fouls that up
 binary-kern-mods:
@@ -401,7 +460,7 @@ kdist_config: prep-deb-files patch-stamp
                --enable-quota \
                --with-kmp-moddir=updates \
                $${EXTRAFLAGS} \
-               $(IB_OPTIONS)
+               $(EXTRA_OPTIONS)
 
 
 kdist_configure: kdist_config
@@ -433,7 +492,7 @@ clean:
        dpatch deapply-all -v
        -$(MAKE) distclean
        rm -rf  debian/substvars debian/*.bak debian/*~ *~  *-stamp
-       ls -d debian/lustre-*-modules-* | grep -v _KVERS_ | xargs rm -f || true
+       ls -d debian/lustre-*-modules-* | grep -v _KVERS_ | grep -v dkms | xargs rm -f || true
        # only remove this if the clean was not called from kdist_clean
        if [ "$$MA_SOURCE_PKG" = "" ]; then \
                rm -rf  debian/m-a_root; \