#!/usr/bin/make -f

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

DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)

CFLAGS = -Wall -g

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

build: build-stamp

build-stamp: 
	dh_testdir
	$(MAKE)
	touch build-stamp

clean: 
	-$(MAKE) clean
	rm build-stamp
	dh_clean 

install: build-stamp
	dh_testdir
	dh_testroot
	dh_clean -k 
	chmod u+x ./install
	./install --prefix=$(CURDIR)/debian/callweaver-sounds/usr/share/callweaver.org

binary-indep: build-stamp install
	dh_testdir
	dh_testroot
#	dh_installchangelogs
#	dh_installdocs
	dh_install
	dh_strip
	dh_compress
	dh_fixperms
	dh_makeshlibs
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

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