#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

TARGETDIR=`pwd`/debian/glimpse

override_dh_auto_configure:
	autoconf
	dh_auto_configure

override_dh_auto_build:
# 	These are the only variables that are free for user
	$(MAKE) DEBUGFLAGS="$(CFLAGS) $(CPPFLAGS)" OTHERLIBS="$(LDFLAGS)"

override_dh_auto_install:
	$(MAKE) install prefix=$(TARGETDIR)/usr
# 	move the internal, optional and undocumented programs into /usr/lib/glimpse
	install -g root -o root -m 0755 -d $(TARGETDIR)/usr/lib/glimpse
	mv $(TARGETDIR)/usr/bin/buildcast $(TARGETDIR)/usr/bin/cast $(TARGETDIR)/usr/bin/uncast \
	   $(TARGETDIR)/usr/bin/tbuild $(TARGETDIR)/usr/bin/wgconvert $(TARGETDIR)/usr/lib/glimpse

#	install (and rename) agrep README:
	install -g root -o root -m 0755 -d $(TARGETDIR)/usr/share/doc/glimpse
	install -g root -o root -m 0644 agrep/README \
		$(TARGETDIR)/usr/share/doc/glimpse/README.agrep

%:
	dh $@ --without autoreconf
