#!/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

# See ENVIRONMENT in dpkg-buildflags(1).
# Package maintainers to append CFLAGS.
#export DEB_CFLAGS_MAINT_APPEND  = -Wall -pedantic
# Package maintainers to append LDFLAGS.
#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
export QT_SELECT := qt5

# This is the debhelper compatibility version to use.
export DH_COMPAT=11

CFLAGS = -g
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
CFLAGS += -O0
else
CFLAGS += -O2
endif

build: build-stamp
build-stamp:
	dh_testdir

	# Add here commands to compile the package.
	  
	(qmake $(CURDIR)/elforkane.pro ; make ;make clean)  

	touch build-stamp

clean:
	dh_testdir
	dh_testroot
	rm -f build-stamp

	# Add here commands to clean up after the build process.
	rm -rf build
        
#	dh_clean

install: 
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs

# %:
# 	dh $@
	mkdir -p $(CURDIR)/debian/elforkane/usr/bin
	mkdir -p $(CURDIR)/debian/elforkane/usr/share/applications
	mkdir -p $(CURDIR)/debian/elforkane/usr/share/elforkane
	#mkdir -p $(CURDIR)/debian/elforkane/usr/lib64/elforkane
	cp  $(CURDIR)/elforkane.desktop $(DEB_DESTDIR)debian/elforkane/usr/share/applications/
	cp -R $(CURDIR)/usr/bin $(DEB_DESTDIR)debian/elforkane/usr/
	cp -R $(CURDIR)/usr/share/icons $(DEB_DESTDIR)debian/elforkane/usr/share/
	cp -R $(CURDIR)/usr/share/elforkane $(DEB_DESTDIR)debian/elforkane/usr/share/
	#cp -R $(CURDIR)/elforkane/usr/lib/elforkane/plugins $(DEB_DESTDIR)debian/elforkane/usr/lib64/elforkane
	#make install $(DEB_DESTDIR)debian/elforkane


# dh_make generated override targets.
# This is an example for Cmake (see <https://bugs.debian.org/641051>).
#override_dh_auto_configure:
#	dh_auto_configure -- \
#	-DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH)

# Build architecture-independent files here.
binary-indep: build install
	# We have nothing to do by default.

# Build architecture-dependent files here.
binary-arch: build install
	dh_testdir
	dh_testroot
#	dh_installdebconf
	dh_installdocs
	dh_installexamples
	dh_installmenu
#	dh_installlogrotate
#	dh_installemacsen
#	dh_installpam
#	dh_installmime
#	dh_installinit
	dh_installcron
	dh_installman
	dh_installinfo
#	dh_undocumented
	dh_installchangelogs
	dh_link
	dh_strip
	dh_compress
	dh_fixperms
#	dh_makeshlibs
	dh_installdeb
#	dh_perl
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install
