#!/usr/bin/make -f
# $MirOS: contrib/hosted/tg/deb/kwalletcli/deb-kde4/rules,v 1.4 2010/03/03 09:28:56 tg Exp $
#-
# -*- 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.

KDE_VER=4

CC ?= gcc
CXX ?= g++

# CXXFLAGS default to CFLAGS, so this is okay
CFLAGS = -Wall -g

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

build: .build_done

.build_done: debian/copyright
	dh_testdir
	CC='${CC}' CXX='${CXX}' CFLAGS='${CFLAGS}' \
	    ${MAKE} -f GNUmakefile KDE_VER=${KDE_VER}
	touch $@

debian/copyright: debian/copyright.hdr LICENCE
	dh_testdir
	cat debian/copyright.hdr LICENCE >$@ || (rm -f $@; exit 1)

clean:
	dh_testdir
	${MAKE} -f GNUmakefile KDE_VER=${KDE_VER} clean
	-rm -f .build_done debian/copyright
	dh_clean

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

# Build architecture-dependent files here.
binary-arch: build
	dh_testdir
	dh_testroot
	dh_installdirs
	${MAKE} -f GNUmakefile KDE_VER=${KDE_VER} install \
	    DESTDIR=$$(pwd)/debian/kwalletcli
	dh_installchangelogs
	dh_installdocs
	dh_strip
	dh_compress
	dh_fixperms
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

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