netlink/Makefile

30 lines
692 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
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
2015-12-18 19:32:50 +00:00
all: fmt 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)):
2014-12-11 19:58:33 +00:00
sudo -E go test -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 ''
.PHONY: fmt
fmt: $(call fmt,$(call testdirs,$(DIRS)))
test: fmt $(call goroot,$(DEPS)) $(call testdirs,$(DIRS))