2016-07-07 01:40:58 -07:00
|
|
|
#BUILD_VERBOSE :=
|
|
|
|
|
BUILD_VERBOSE := -v
|
|
|
|
|
|
2016-08-19 17:14:17 -07:00
|
|
|
#TEST_VERBOSE :=
|
2016-07-14 14:50:14 -07:00
|
|
|
TEST_VERBOSE := -v
|
2016-06-06 12:49:53 -07:00
|
|
|
|
2016-08-05 18:19:51 -07:00
|
|
|
DOCKER_IMAGE_NAME := $$USER/coredns
|
|
|
|
|
|
2016-08-19 17:14:17 -07:00
|
|
|
all: coredns
|
2016-08-05 18:19:51 -07:00
|
|
|
|
2016-08-19 17:14:17 -07:00
|
|
|
# Phony this to ensure we always build the binary.
|
|
|
|
|
# TODO: Add .go file dependencies.
|
|
|
|
|
.PHONY: coredns
|
2016-09-24 22:47:30 +01:00
|
|
|
coredns: deps
|
2016-08-05 18:19:51 -07:00
|
|
|
go build $(BUILD_VERBOSE) -ldflags="-s -w"
|
2016-04-13 20:14:13 +01:00
|
|
|
|
|
|
|
|
.PHONY: docker
|
2016-08-19 17:14:17 -07:00
|
|
|
docker: deps
|
|
|
|
|
CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w"
|
2016-08-05 18:19:51 -07:00
|
|
|
docker build -t $(DOCKER_IMAGE_NAME) .
|
2016-04-28 11:07:44 -07:00
|
|
|
|
|
|
|
|
.PHONY: deps
|
2016-09-24 22:47:30 +01:00
|
|
|
deps:
|
2016-07-07 01:40:58 -07:00
|
|
|
go get ${BUILD_VERBOSE}
|
2016-04-28 11:07:44 -07:00
|
|
|
|
|
|
|
|
.PHONY: test
|
2016-08-19 17:14:17 -07:00
|
|
|
test: deps
|
2016-07-07 01:40:58 -07:00
|
|
|
go test $(TEST_VERBOSE) ./...
|
2016-04-28 11:07:44 -07:00
|
|
|
|
2016-07-14 14:50:14 -07:00
|
|
|
.PHONY: testk8s
|
2016-08-19 17:14:17 -07:00
|
|
|
testk8s: deps
|
2016-08-05 18:19:51 -07:00
|
|
|
# With -args --v=100 the k8s API response data will be printed in the log:
|
|
|
|
|
#go test $(TEST_VERBOSE) -tags=k8s -run 'TestK8sIntegration' ./test -args --v=100
|
|
|
|
|
# Without the k8s API response data:
|
2016-07-27 10:01:24 -07:00
|
|
|
go test $(TEST_VERBOSE) -tags=k8s -run 'TestK8sIntegration' ./test
|
2016-07-14 14:50:14 -07:00
|
|
|
|
2016-08-05 18:19:51 -07:00
|
|
|
.PHONY: testk8s-setup
|
2016-08-19 17:14:17 -07:00
|
|
|
testk8s-setup: deps
|
|
|
|
|
go test -v ./middleware/kubernetes/... -run TestKubernetes
|
2016-08-05 18:19:51 -07:00
|
|
|
|
2016-04-28 11:07:44 -07:00
|
|
|
.PHONY: clean
|
|
|
|
|
clean:
|
|
|
|
|
go clean
|
2016-08-19 17:14:17 -07:00
|
|
|
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
|