#!/usr/bin/make -f
# Set DH_VERBOSE to 1 to enable debuging
export DH_VERBOSE=0

#Add build flags
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk

%:
	dh $@ --with autoreconf

override_dh_auto_configure:

	dh_testdir
	# update config files
	chmod +x debian/configupdate
	debian/configupdate update
	dh_auto_configure -- --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)"  CPPFLAGS="$(CPPFLAGS)" --enable-dependency-tracking

override_dh_auto_build:
	$(MAKE) sigdesc.h
	$(MAKE)

override_dh_auto_install:
	$(MAKE) prefix=$(CURDIR)/debian/pgtop/usr install

clean:
	dh_testdir
	dh_testroot
	# Clean up after build, including reverting updates of config files
	if [ -f Makefile ]; then $(MAKE) distclean; fi
	chmod +x debian/configupdate
	debian/configupdate reset
	# Remove extra cruft left over
	rm -f sigdesc.h
	dh_clean 

