Files
coredns/Makefile
Yong Tang 9b6b8d2762 Cleanup Makefile and .travis.yml (#305)
This fix updates .travis.yml and Makefile for several places:
- Remove unneeded `docker pull gcr.io/google_containers/hyperkube-amd64:v1.2.4` (only v1.3.7 was used)
- Use docker to deploy etcd (insteadof downloading etcd binary).
- Merge `make testk8s` and `make testk8s-setup` (no need to have multiple targets for a couple of tests)
- Set version of etcd and kubernetes in .travis.yml (so that it is easy to update new version in the future)

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2016-09-27 07:57:04 +08:00

58 lines
1.4 KiB
Makefile

BUILD_VERBOSE := -v
TEST_VERBOSE := -v
DOCKER_IMAGE_NAME := $$USER/coredns
all: coredns
# Phony this to ensure we always build the binary.
# TODO: Add .go file dependencies.
.PHONY: coredns
coredns: deps
go build $(BUILD_VERBOSE) -ldflags="-s -w"
.PHONY: docker
docker: deps
CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w"
docker build -t $(DOCKER_IMAGE_NAME) .
.PHONY: deps
deps:
go get ${BUILD_VERBOSE}
.PHONY: test
test: deps
go test $(TEST_VERBOSE) ./...
.PHONY: testk8s
testk8s: deps
go test $(TEST_VERBOSE) -tags=k8s -run 'TestKubernetes' ./test ./middleware/kubernetes/...
.PHONY: coverage
coverage: deps
set -e -x
echo "" > coverage.txt
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; \
if [ -f cover.out ]; then \
cat cover.out >> coverage.txt; \
rm cover.out; \
fi; \
done
.PHONY: clean
clean:
go clean
rm -f coredns
.PHONY: distclean
distclean: clean
# Clean all dependencies and build artifacts
find $(GOPATH)/pkg -maxdepth 1 -mindepth 1 | xargs rm -rf
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