#!/usr/bin/make -f
# -*- makefile -*-

-include /usr/share/dpkg/buildflags.mk

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

configure: configure-stamp
configure-stamp:
	dh_testdir
	(cd activemq-cpp; \
	 mkdir config || :; \
	 ./autogen.sh; \
	 ./configure --prefix=/usr)
	touch $@

build: build-arch build-indep

build-arch build-indep: build-stamp

build-stamp: configure-stamp
	dh_testdir
	CFLAGS="$(CFLAGS) $(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" $(MAKE) -C activemq-cpp
	touch $@

clean: configure-stamp
	dh_testdir
	dh_testroot
	rm -f build-stamp
	$(MAKE) -C activemq-cpp clean
	rm -f activemq-cpp/config.log activemq-cpp/config.status
	dh_clean

install: build-stamp
	dh_testdir
	dh_testroot
	dh_prep
	dh_installdirs
	$(MAKE) -C activemq-cpp install DESTDIR=$(CURDIR)/debian/tmp
	rm -vf $(CURDIR)/debian/tmp/usr/lib/*.la
	rm -vf $(CURDIR)/debian/tmp/usr/lib/*.a
	mv $(CURDIR)/debian/tmp/usr/bin/example $(CURDIR)/debian/tmp/usr/bin/activemqcpp-example

binary-indep:

binary-arch: install
	dh_testdir
	dh_testroot
	dh_installchangelogs
	dh_installdocs
	dh_installexamples
	dh_installman
	dh_installlogrotate
	dh_installcron
	dh_install --fail-missing
	dh_link
	dh_strip --dbg-package=activemq-cpp-dbg
	dh_compress
	dh_fixperms
	dh_makeshlibs
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary: binary-arch binary-indep
