1DIRS := \ 2 . \ 3 nl 4 5DEPS = \ 6 github.com/vishvananda/netns 7 8uniq = $(if $1,$(firstword $1) $(call uniq,$(filter-out $(firstword $1),$1))) 9testdirs = $(call uniq,$(foreach d,$(1),$(dir $(wildcard $(d)/*_test.go)))) 10goroot = $(addprefix ../../../,$(1)) 11unroot = $(subst ../../../,,$(1)) 12fmt = $(addprefix fmt-,$(1)) 13 14all: fmt 15 16$(call goroot,$(DEPS)): 17 go get $(call unroot,$@) 18 19.PHONY: $(call testdirs,$(DIRS)) 20$(call testdirs,$(DIRS)): 21 sudo -E go test -v github.com/vishvananda/netlink/$@ 22 23$(call fmt,$(call testdirs,$(DIRS))): 24 ! gofmt -l $(subst fmt-,,$@)/*.go | grep '' 25 26.PHONY: fmt 27fmt: $(call fmt,$(call testdirs,$(DIRS))) 28 29test: fmt $(call goroot,$(DEPS)) $(call testdirs,$(DIRS)) 30