#!/usr/bin/make -f
# -*- makefile -*-

export DH_VERBOSE=1

PACKAGE=gparted

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 -O3

config.status: configure
	dh_testdir
	CFLAGS="$(CFLAGS)" ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info

build: build-stamp patch

build-stamp:  config.status
	dh_testdir
	$(MAKE)
	$(MAKE) check
	touch build-stamp

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

install: build
	dh_testdir
	dh_testroot
	dh_clean -k 
	dh_installdirs

	$(MAKE) install DESTDIR=$(CURDIR)/debian/gparted


binary-indep: build install

binary-arch: build install
	dh_testdir
	dh_testroot
	dh_installchangelogs ChangeLog
	dh_installdocs
	dh_installexamples
	dh_installmenu
	dh_install
	mv debian/gparted/usr/bin/gparted debian/gparted/usr/bin/gparted-bin
	cp debian/gparted-launcher.sh debian/gparted/usr/bin/gparted
	cp debian/gparted.xpm debian/gparted/usr/share/pixmaps
	dh_installman debian/gparted.1
	dh_link usr/share/man/man1/gparted.1 usr/share/man/man1/gparted-bin.1
	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 patch unpatch

