#!/usr/bin/make -f

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

export DH_GOLANG_INSTALL_EXTRA := cmd/bpf2go/gen/output.tpl
export DH_GOLANG_EXCLUDES := \
	cmd/bpf2go/test \
	internal/cmd/gentypes \
	testdata/docker \
	testdata/windows

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

B = $(CURDIR)/debian/tmp/usr/bin
M = $(CURDIR)/debian/tmp/usr/share/man/man1

ifeq (,$(filter nodoc,$(DEB_BUILD_PROFILES)))
execute_before_dh_installman-arch:
	mkdir -pv $(M)
	help2man --version-string="$(DEB_VERSION)" \
		--name="Compile C to eBPF and emit Go code" \
		--no-info \
		-o $(M)/bpf2go.1 \
		$(B)/bpf2go
endif

# In most environments, tests are running in schroot,
# which has no permission to run bpf programs.
override_dh_auto_test:
	-dh_auto_test
