#!/usr/bin/make -f

#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)


config.status: configure
	dh_testdir
	./configure $(shell DEB_CFLAGS_MAINT_APPEND=-Wall dpkg-buildflags --export=configure) --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info

build: build-arch build-indep

build-arch: build-stamp

build-indep: build-stamp

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

	touch build-stamp

clean: 
	dh_testdir
	dh_testroot
	rm -f build-stamp
	-rm -f parser.c parser.h scanner.c 
	#-rm -f config.cache/status #remove this in next release
	[ ! -f Makefile ] || $(MAKE) distclean

	dh_clean 

install: build
	dh_testdir
	dh_testroot
	dh_prep
	dh_installdirs
	dh_installmenu

	$(MAKE) install DESTDIR=$(CURDIR)/debian/wcalc
	cp -a $(CURDIR)/debian/wcalc.xpm $(CURDIR)/debian/wcalc/usr/share/pixmaps/

binary-indep: build install

binary-arch: build install
	dh_installchangelogs ChangeLog
	dh_installdocs
	dh_installexamples
	dh_installman
	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 
