#!/usr/bin/make -f

# Include test fixtures
export DH_GOLANG_INSTALL_EXTRA := cobra/cmd/testdata

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

# We need to add -tags to for gccgo to handle MIPS architectures where
# gccgo uses "mipso32" for mips/mipsle and "mipsn64" for mips64/mips64le
ifeq ($(findstring mips,$(DEB_BUILD_ARCH)),mips)
# mipsel => mipsle, mips64el => mips64le
BUILDTAGS := $(DEB_BUILD_ARCH:el=le)
endif

ifdef BUILDTAGS
override_dh_auto_build:
	dh_auto_build -O--buildsystem=golang -O--no-parallel -- -tags $(BUILDTAGS)

override_dh_auto_test:
	dh_auto_test -O--buildsystem=golang -O--no-parallel -- -tags $(BUILDTAGS)
endif
