#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.

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

package = packagerate

CC = gcc
CFLAGS = -Wall -g

ifeq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
	CFLAGS += -O2
endif

clean:
	dh_clean
	rm -f build
	-$(MAKE) -i distclean

install: build
	dh_clean

	$(MAKE) prefix=$(CURDIR)/debian/$(package)/usr/ install

	dh_installdirs usr/share/applications/hildon
	cp data/maemo/$(package).desktop $(CURDIR)/debian/$(package)/usr/share/applications/hildon

	dh_installdirs usr/share/dbus-1/services
	cp data/maemo/*.service $(CURDIR)/debian/$(package)/usr/share/dbus-1/services

#	dh_installdirs usr/share/$(package)/catalogs
#	cp catalogs/*.xml $(CURDIR)/debian/$(package)/usr/share/$(package)/catalogs

	dh_installdirs usr/share/icons/hicolor/26x26/apps
	cp data/icons/icon26x26.png $(CURDIR)/debian/$(package)/usr/share/icons/hicolor/26x26/apps/PackageRate.png
		        
	dh_installdirs usr/share/icons/hicolor/40x40/apps
	cp data/icons/icon40x40.png $(CURDIR)/debian/$(package)/usr/share/icons/hicolor/40x40/apps/PackageRate.png
					        
	dh_installdirs usr/share/icons/hicolor/scalable/apps
	cp data/icons/icon64x64.png $(CURDIR)/debian/$(package)/usr/share/icons/hicolor/scalable/apps/PackageRate.png

build:
	./configure --prefix=/usr
	$(MAKE) CC="$(CC)" CFLAGS="$(CFLAGS)"
	touch build

# Build architecture-independent files here.
binary-indep: build install
# We have nothing to do by default.

# Build architecture-dependent files here.
binary-arch: build install
	dh_testroot
	dh_installchangelogs ChangeLog
	dh_installdocs
#	dh_installmenu
#	dh_installman
	dh_strip
	dh_compress
	dh_fixperms
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary: binary-indep binary-arch
.PHONY: binary binary-arch binary-indep clean checkroot
