#!/usr/bin/make -f

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

export DH_GOPKG := github.com/docker/swarm

%:
	dh $@ --buildsystem=golang --with=golang,systemd --builddirectory=_build

override_dh_clean:
	dh_clean
	## Remove Files-Excluded (when built from checkout or non-DFSG tarball):
	$(RM) -rv `perl -0nE 'say $$1 if m{^Files\-Excluded\:\s*(.*?)(?:\n\n|Files:|Comment:)}sm;' debian/copyright`

override_dh_auto_configure:
	mkdir -p Godeps/_workspace/src
	mkdir -p _build && cp -r Godeps/_workspace/src _build/
	dh_auto_configure -v

override_dh_install:
	dh_install
	$(RM) -rf debian/docker-swarm/usr/share/gocode
	## Must rename executable due to conflict with "swarm":
	rename -v 's{swarm\Z}{docker-swarm}' debian/docker-swarm/usr/bin/swarm

override_dh_installinit:
	dh_installinit --no-start

override_dh_systemd_start:
	dh_systemd_start --no-start

override_dh_systemd_enable:
	dh_systemd_enable --no-enable

override_dh_auto_test:
	-dh_auto_test
