#!/usr/bin/make -f

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

# Maemo specific (Qt 4.6)
PATH:=/opt/qt4-maemo5/bin:$(PATH) 
export PATH 

CFLAGS = -Wall -g

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

configure:
	dh_testdir
	cmake .
	touch $@
 
build: configure
	$(MAKE)
	touch $@

clean:
	dh_testdir
	dh_testroot
	-$(MAKE) clean
	rm -f CMakeCache.txt
	rm -rf `find -name CMakeFiles` 
	rm -f configure
	rm -f build
	dh_clean 

install: build
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs
	$(MAKE) DESTDIR=$(CURDIR)/debian/tmp install
	dh_install --sourcedir=debian/tmp
	
# Build architecture-independent files here.
binary-indep: install
# We have nothing to do by default.

# Build architecture-dependent files here.
binary-arch: install
	dh_testdir
	dh_testroot
	dh_installchangelogs
	dh_strip
	dh_compress
	dh_fixperms
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	maemo-optify
	dh_builddeb

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