netlink/Makefile

31 lines
745 B
Makefile
Raw Normal View History

2014-10-31 18:45:51 +00:00
DIRS := \
. \
nl
2014-10-31 19:27:21 +00:00
DEPS = \
github.com/vishvananda/netns \
golang.org/x/sys/unix
2014-10-31 19:27:21 +00:00
2014-10-31 18:45:51 +00:00
uniq = $(if $1,$(firstword $1) $(call uniq,$(filter-out $(firstword $1),$1)))
testdirs = $(call uniq,$(foreach d,$(1),$(dir $(wildcard $(d)/*_test.go))))
2014-10-31 19:27:21 +00:00
goroot = $(addprefix ../../../,$(1))
unroot = $(subst ../../../,,$(1))
2014-12-11 21:48:16 +00:00
fmt = $(addprefix fmt-,$(1))
2014-10-31 18:45:51 +00:00
2016-03-20 00:12:26 +00:00
all: test
2014-10-31 18:45:51 +00:00
2014-10-31 19:27:21 +00:00
$(call goroot,$(DEPS)):
go get $(call unroot,$@)
2014-10-31 18:45:51 +00:00
.PHONY: $(call testdirs,$(DIRS))
$(call testdirs,$(DIRS)):
sudo -E go test -test.parallel 4 -timeout 60s -v github.com/vishvananda/netlink/$@
2014-10-31 18:45:51 +00:00
2014-12-11 21:48:16 +00:00
$(call fmt,$(call testdirs,$(DIRS))):
! gofmt -l $(subst fmt-,,$@)/*.go | grep -q .
2014-12-11 21:48:16 +00:00
.PHONY: fmt
fmt: $(call fmt,$(call testdirs,$(DIRS)))
test: fmt $(call goroot,$(DEPS)) $(call testdirs,$(DIRS))