Files
coredns/Makefile
Yong Tang 9d39ea51a7 Add go mod support (#2503)
* Remove vendor and go-dep

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>

* Add go.mod

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>

* Update Makefile and .travis.yml

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2019-03-03 11:56:26 -08:00

68 lines
1.9 KiB
Makefile

# Makefile for building CoreDNS
GITCOMMIT:=$(shell git describe --dirty --always)
BINARY:=coredns
SYSTEM:=
CHECKS:=check
BUILDOPTS:=-v
GOPATH?=$(HOME)/go
PRESUBMIT:=core coremain plugin test request
MAKEPWD:=$(dir $(realpath $(firstword $(MAKEFILE_LIST))))
CGO_ENABLED:=0
.PHONY: all
all: coredns
.PHONY: coredns
coredns: $(CHECKS)
GO111MODULE=on CGO_ENABLED=$(CGO_ENABLED) $(SYSTEM) go build $(BUILDOPTS) -ldflags="-s -w -X github.com/coredns/coredns/coremain.GitCommit=$(GITCOMMIT)" -o $(BINARY)
.PHONY: check
check: presubmit core/plugin/zplugin.go core/dnsserver/zdirectives.go
.PHONY: travis
travis:
ifeq ($(TEST_TYPE),core)
( cd request ; GO111MODULE=on go test -v -tags 'etcd' -race ./... )
( cd core ; GO111MODULE=on go test -v -tags 'etcd' -race ./... )
( cd coremain ; GO111MODULE=on go test -v -tags 'etcd' -race ./... )
endif
ifeq ($(TEST_TYPE),integration)
( cd test ; GO111MODULE=on go test -v -tags 'etcd' -race ./... )
endif
ifeq ($(TEST_TYPE),plugin)
( cd plugin ; GO111MODULE=on go test -v -tags 'etcd' -race ./... )
endif
ifeq ($(TEST_TYPE),coverage)
for d in `go list ./... | grep -v vendor`; do \
t=$$(date +%s); \
GO111MODULE=on go test -i -tags 'etcd' -coverprofile=cover.out -covermode=atomic $$d || exit 1; \
GO111MODULE=on go test -v -tags 'etcd' -coverprofile=cover.out -covermode=atomic $$d || exit 1; \
echo "Coverage test $$d took $$(($$(date +%s)-t)) seconds"; \
if [ -f cover.out ]; then \
cat cover.out >> coverage.txt; \
rm cover.out; \
fi; \
done
endif
core/plugin/zplugin.go core/dnsserver/zdirectives.go: plugin.cfg
GO111MODULE=on go generate coredns.go
.PHONY: gen
gen:
GO111MODULE=on go generate coredns.go
.PHONY: pb
pb:
$(MAKE) -C pb
# Presubmit runs all scripts in .presubmit; any non 0 exit code will fail the build.
.PHONY: presubmit
presubmit:
@for pre in $(MAKEPWD)/.presubmit/* ; do "$$pre" $(PRESUBMIT) || exit 1 ; done
.PHONY: clean
clean:
GO111MODULE=on go clean
rm -f coredns