#!/usr/bin/make -f
# See debhelper(7) (uncomment to enable)
# output every command that modifies files on the build system.
export DH_VERBOSE = 1


# see FEATURE AREAS in dpkg-buildflags(1)
export DEB_BUILD_MAINT_OPTIONS = hardening=+all

DEB_BUILD_ARCH ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH)

ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
CUFLAGS = -O0
else
ifneq (,$(findstring i386,$(DEB_BUILD_ARCH)))
CUFLAGS = -O3 -fomit-frame-pointer -march=i586 -mmmx -mno-sse4 -mno-sse3 -msse 
endif
ifneq (,$(findstring i486,$(DEB_BUILD_ARCH)))
CUFLAGS = -O3 -fomit-frame-pointer -march=i586 -mmmx -mno-sse4 -mno-sse3 -msse 
else
CUFLAGS = -O3 -fomit-frame-pointer -mno-sse4 -mno-sse3 -mno-sse2 
endif

ifneq (,$(findstring amd64,$(DEB_BUILD_ARCH)))
CUFLAGS = -O3 -fomit-frame-pointer -mmmx -mno-sse4 -mno-sse3 -msse 
endif

endif

export DEB_CFLAGS_MAINT_APPEND  = -Wall -pedantic $(CUFLAGS)
export DEB_CXXFLAGS_MAINT_APPEND  = -Wall -pedantic $(CUFLAGS)
export CFLAGS=$(CUFLAGS)
export CXXFLAGS=$(CUFLAGS)

devi := $(shell lsb_release -r -s | cut -d '.'  -f1)
ifeq ($(shell if [ $(devi) -gt 6 ] ; then echo gt ; else echo lt ; fi),gt)
   DEBVE=yes
else
   DEBVE=no
endif


%:
ifeq ($(DEBVE),yes)
	dh $@ --with autoreconf,autotools_dev
else
	dh $@ --with autoreconf
endif

override_dh_auto_clean:
	dh_auto_clean -- || true

#override_dh_auto_configure:
#	dh_auto_configure --  --disable-nls

override_dh_autoreconf:
	intltoolize -f -c
	dh_autoreconf -- 

override_dh_auto_test:
	

override_dh_install:
	mkdir -p debian/emount/usr/share/pixmaps/
	cp -f debian/emount.xpm debian/emount/usr/share/pixmaps/
	dh_install -- 
