#!/usr/bin/make -f

include /usr/share/dpkg/pkg-info.mk

# Enable verbose mode (optional)
export DH_VERBOSE=1
UPSTREAM_CLEAN := $(firstword $(subst +, ,$(DEB_VERSION_UPSTREAM)))
export UPSTREAM_CLEAN

%:
	dh $@ --buildsystem=gradle

override_dh_auto_clean:
#	#$(MAKE) clean || true
	dh_auto_clean -- clean
	rm -rf .gradle build
	#rm -f debian/files

override_dh_auto_build:
	# Compile the rst source file into a traditional man page
	rst2man debian/ipscan.1.rst debian/ipscan.1
	#$(MAKE) linux64 || true
	dh_auto_build -- linux64

override_dh_install:
	# 1. Run the standard dh_install first for all your other files
	dh_install

	# 2. Sort out the application icon (rename and copy)
	mkdir -p debian/ipscan/usr/share/pixmaps/
	cp resources/images/icon128.png debian/ipscan/usr/share/pixmaps/ipscan.png
	
	# 3. Sort out the application desktop filename
	mkdir -p debian/ipscan/usr/share/applications/
	cp ext/deb-bundle/usr/share/applications/ipscan.desktop debian/ipscan/usr/share/applications/net.azlib.ipscan.desktop
	
override_dh_auto_test:
	# Do nothing to skip tests
