diff options
author | 2016-08-19 17:14:17 -0700 | |
---|---|---|
committer | 2016-08-19 17:14:17 -0700 | |
commit | 9ac3cab1b7b1b1e78f86ce3c6a80fbee312162e6 (patch) | |
tree | 437e9755927c33af16276ad2602a6da115f948cb /Makefile | |
parent | a1989c35231b0e5ea271b2f68d82c1a63e697cd0 (diff) | |
download | coredns-9ac3cab1b7b1b1e78f86ce3c6a80fbee312162e6.tar.gz coredns-9ac3cab1b7b1b1e78f86ce3c6a80fbee312162e6.tar.zst coredns-9ac3cab1b7b1b1e78f86ce3c6a80fbee312162e6.zip |
Make CoreDNS a server type plugin for Caddy (#220)
* Make CoreDNS a server type plugin for Caddy
Remove code we don't need and port all middleware over. Fix all tests
and rework the documentation.
Also make `go generate` build a caddy binary which we then copy into
our directory. This means `go build`-builds remain working as-is.
And new etc instances in each etcd test for better isolation.
Fix more tests and rework test.Server with the newer support Caddy offers.
Fix Makefile to support new mode of operation.
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 42 |
1 files changed, 33 insertions, 9 deletions
@@ -1,39 +1,63 @@ #BUILD_VERBOSE := BUILD_VERBOSE := -v -TEST_VERBOSE := +#TEST_VERBOSE := TEST_VERBOSE := -v DOCKER_IMAGE_NAME := $$USER/coredns +all: coredns -all: +# Phony this to ensure we always build the binary. +# TODO: Add .go file dependencies. +.PHONY: coredns +coredns: generate deps go build $(BUILD_VERBOSE) -ldflags="-s -w" .PHONY: docker -docker: all - GOOS=linux go build -a -tags netgo -installsuffix netgo -ldflags="-s -w" +docker: deps + CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" docker build -t $(DOCKER_IMAGE_NAME) . +../../mholt/caddy: + # Get caddy so we can generate into that codebase + # before getting all other dependencies. + go get ${BUILD_VERBOSE} github.com/mholt/caddy + +.PHONY: generate +generate: ../../mholt/caddy + go generate $(BUILD_VERSOSE) + .PHONY: deps -deps: +deps: generate go get ${BUILD_VERBOSE} .PHONY: test -test: +test: deps go test $(TEST_VERBOSE) ./... .PHONY: testk8s -testk8s: +testk8s: deps # 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: go test $(TEST_VERBOSE) -tags=k8s -run 'TestK8sIntegration' ./test .PHONY: testk8s-setup -testk8s-setup: - go test -v ./core/setup -run TestKubernetes +testk8s-setup: deps + go test -v ./middleware/kubernetes/... -run TestKubernetes .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 |