github.com/vishvananda/netlink@v1.3.0/Makefile (about)

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