#!/usr/bin/make -f
# Sample debian/rules that uses debhelper.
# GNU copyright 1997 to 1999 by Joey Hess.

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

CFLAGS = -Wall -g

ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
	CFLAGS += -O0
else
	CFLAGS += -O2
endif

version=`head -n 1 debian/changelog | cut -d '(' -f 2- | cut -d ')' -f 1`
soname=`echo $$version | cut -d . -f -2`

build:
	dh_testdir
	
	$(MAKE) build CFLAGS="$(CFLAGS)"

clean:
	dh_testdir
	dh_testroot
	rm -f build-stamp configure-stamp
	
	-$(MAKE) clean
	
	dh_clean

install: build
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs
	
	$(MAKE) install DESTDIR="$(CURDIR)/debian/tmp"

binary-indep: build install
# Nothing to do

binary-arch: build install
	dh_testdir
	dh_testroot
	dh_installchangelogs
	dh_installdocs
	dh_installexamples
	dh_movefiles
#	dh_install
#	dh_installdebconf
#	dh_installinit
#	dh_installinfo
	dh_installman
	dh_link
	dh_strip
	dh_compress
	dh_fixperms
	dh_makeshlibs -V "libpmount$(soname) (>= $(version))"
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary: binary-indep binary-arch

.PHONY: build clean binary-indep binary-arch binary install

