#! /usr/bin/make -f
-build:
- rm -rf deb-build build; mkdir deb-build
- cd deb-build; ../configure \
- --prefix=/usr \
- --mandir=/usr/share/man \
- --libexecdir=/usr/lib
- make -C deb-build
- make -C deb-build check
- touch build
-
-clean:
- dh_clean
- rm -rf deb-build build
-
-install: build
- dh_clean
- make -C deb-build install DESTDIR=`pwd`/debian/tmp
- rm -f debian/tmp/usr/lib/*.la
- mkdir -p debian/mlib-dev/usr/lib
- mkdir -p debian/mlib-dev/usr/share/man
- mkdir -p debian/mlib-dev/usr/bin
- mv debian/tmp/usr/bin/mLib-config debian/mlib-dev/usr/bin
- mv debian/tmp/usr/share/man/man3 debian/mlib-dev/usr/share/man
- mv debian/tmp/usr/lib/*.a debian/mlib-dev/usr/lib
- mv debian/tmp/usr/lib/*.so debian/mlib-dev/usr/lib
- mv debian/tmp/usr/include debian/mlib-dev/usr
- dh_strip -a
-
-binary-indep:
-
-binary-arch: install
- dh_testdir -a
- dh_testroot -a
- dh_makeshlibs -a
- dh_installman -a
- dh_compress -a
- dh_installdocs -a
- dh_shlibdeps -a
- dh_gencontrol -a
- dh_fixperms -a
- dh_installdeb -a
- dh_md5sums -a
- dh_builddeb -a
-
-binary: binary-indep binary-arch
-
-source:
- rm -rf deb-build/*.tar.gz deb-build/=deb=
- make -C deb-build dist PACKAGE=mlib
- mkdir deb-build/=deb=
- cd deb-build/=deb=; tar xvfz ../*.tar.gz
- d=`pwd`; cd ..; dpkg-source -i -b $$d/deb-build/=deb=/*
- rm -rf deb-build/=deb=
-
-.PHONY: binary binary-arch binary-indep clean install source
+CDBS = /usr/share/cdbs/1
+
+include $(CDBS)/rules/debhelper.mk
+include $(CDBS)/class/autotools.mk
+
+###--------------------------------------------------------------------------
+### General settings.
+
+DEB_BUILDDIR = $(CURDIR)/build
+DEB_MAKE_CHECK_TARGET = check
+
+DEB_CONFIGURE_EXTRA_FLAGS = --without-adns
+DEB_CONFIGURE_LIBEXECDIR = "\$${prefix}/lib"
+
+DEB_DH_MAKESHLIBS_ARGS_ALL = \
+ -V"mlib2 (>= $(DEB_UPSTREAM_VERSION)) | mlib2-adns (>= $(DEB_UPSTREAM_VERSION))"
+
+###--------------------------------------------------------------------------
+### Building the ADNS version.
+
+DEB_CONFIGURE_EXTRA_FLAGS_mlib2-adns = --with-adns
+DEB_BUILDDIR_mlib2-adns = $(CURDIR)/build-adns
+
+configure/mlib2-adns::
+ $(DEB_CONFIGURE_INVOKE) \
+ $(cdbs_configure_flags) \
+ $(DEB_CONFIGURE_EXTRA_FLAGS_mlib2-adns) \
+ $(DEB_CONFIGURE_USER_FLAGS)
+
+build/mlib2-adns::
+ $(DEB_MAKE_ENVVARS) $(MAKE) -C $(DEB_BUILDDIR_mlib2-adns)
+
+install/mlib2-adns::
+ $(DEB_MAKE_ENVVARS) $(MAKE) -C $(DEB_BUILDDIR_mlib2-adns) \
+ install DESTDIR=$(CURDIR)/debian/tmp-adns
+
+clean::
+ rm -rf $(CURDIR)/debian/tmp-adns
+
+###----- That's all, folks --------------------------------------------------