Makefile cleanup (#903)

Remove unused distclean and misc.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
This commit is contained in:
Yong Tang
2017-08-11 19:47:28 -07:00
committed by GitHub
parent a09f208c51
commit 1ddafcbdff

View File

@@ -1,31 +1,23 @@
GITCOMMIT:=$(shell git describe --dirty --always) GITCOMMIT:=$(shell git describe --dirty --always)
BUILD_VERBOSE := -v
TEST_VERBOSE := -v
all: coredns all: coredns
# Phony this to ensure we always build the binary. # Phony this to ensure we always build the binary.
# TODO: Add .go file dependencies. # TODO: Add .go file dependencies.
.PHONY: coredns .PHONY: coredns
coredns: check godeps coredns: check godeps
CGO_ENABLED=0 go build $(BUILD_VERBOSE) -ldflags="-s -w -X github.com/coredns/coredns/coremain.gitCommit=$(GITCOMMIT)" CGO_ENABLED=0 go build -v -ldflags="-s -w -X github.com/coredns/coredns/coremain.gitCommit=$(GITCOMMIT)"
.PHONY: deps
deps: core/zmiddleware.go core/dnsserver/zdirectives.go godeps
go get -u github.com/golang/lint/golint
.PHONY: check .PHONY: check
check: fmt deps check: fmt core/zmiddleware.go core/dnsserver/zdirectives.go godeps
.PHONY: test .PHONY: test
test: check test: check
go test -race $(TEST_VERBOSE) ./test ./middleware/... go test -race -v ./test ./middleware/...
.PHONY: testk8s .PHONY: testk8s
testk8s: check testk8s: check
go test -race $(TEST_VERBOSE) -tags=k8s -run 'TestKubernetes' ./test ./middleware/kubernetes/... go test -race -v -tags=k8s -run 'TestKubernetes' ./test ./middleware/kubernetes/...
.PHONY: godeps .PHONY: godeps
godeps: godeps:
@@ -39,18 +31,13 @@ coverage: check
set -e -x set -e -x
echo "" > coverage.txt echo "" > coverage.txt
for d in `go list ./... | grep -v vendor`; do \ for d in `go list ./... | grep -v vendor`; do \
go test $(TEST_VERBOSE) -tags 'etcd k8s' -race -coverprofile=cover.out -covermode=atomic -bench=. $$d || exit 1; \ go test -v -tags 'etcd k8s' -race -coverprofile=cover.out -covermode=atomic -bench=. $$d || exit 1; \
if [ -f cover.out ]; then \ if [ -f cover.out ]; then \
cat cover.out >> coverage.txt; \ cat cover.out >> coverage.txt; \
rm cover.out; \ rm cover.out; \
fi; \ fi; \
done done
.PHONY: clean
clean:
go clean
rm -f coredns
core/zmiddleware.go core/dnsserver/zdirectives.go: middleware.cfg core/zmiddleware.go core/dnsserver/zdirectives.go: middleware.cfg
go generate coredns.go go generate coredns.go
@@ -65,17 +52,13 @@ fmt:
(echo "please format Go code with 'gofmt -s -w'" && false) (echo "please format Go code with 'gofmt -s -w'" && false)
.PHONY: lint .PHONY: lint
lint: deps lint:
## run go lint, suggestion only (not enforced) ## run go lint, suggestion only (not enforced)
go get -u github.com/golang/lint/golint
@test -z "$$(find . -type d | grep -vE '(/vendor|^\.$$|/.git|/.travis)' | grep -vE '(^\./pb)' | xargs golint \ @test -z "$$(find . -type d | grep -vE '(/vendor|^\.$$|/.git|/.travis)' | grep -vE '(^\./pb)' | xargs golint \
| grep -vE "context\.Context should be the first parameter of a function" | tee /dev/stderr)" | grep -vE "context\.Context should be the first parameter of a function" | tee /dev/stderr)"
.PHONY: distclean .PHONY: clean
distclean: clean clean:
# Clean all dependencies and build artifacts go clean
find $(GOPATH)/pkg -maxdepth 1 -mindepth 1 | xargs rm -rf rm -f coredns
find $(GOPATH)/bin -maxdepth 1 -mindepth 1 | xargs rm -rf
find $(GOPATH)/src -maxdepth 1 -mindepth 1 | grep -v github | xargs rm -rf
find $(GOPATH)/src -maxdepth 2 -mindepth 2 | grep -v miekg | xargs rm -rf
find $(GOPATH)/src/github.com/miekg -maxdepth 1 -mindepth 1 \! -name \*coredns\* | xargs rm -rf