#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

# Include version number
include /usr/share/dpkg/pkg-info.mk
VERSION = $(shell echo $(DEB_VERSION) | cut -d+ -f1)
LDFLAGS := '-X main.Build=$(VERSION)'

# gvisor based service library is somewhat experimental,
# see https://github.com/slackhq/nebula/pull/965
# Also, it fails on s390x
SKIP_TESTS += TestService

%:
	dh $@ --buildsystem=golang --with=golang

override_dh_auto_build:
	dh_auto_build --buildsystem=golang -- -ldflags $(LDFLAGS)

override_dh_auto_test:
	dh_auto_test --buildsystem=golang -- -skip "$(subst $(eval ) ,|,$(SKIP_TESTS))"
