2017-10-30 15:55:41 +00:00
|
|
|
# Makefile for building CoreDNS
|
2017-08-11 19:47:28 -07:00
|
|
|
GITCOMMIT:=$(shell git describe --dirty --always)
|
2017-08-13 09:41:50 -07:00
|
|
|
BINARY:=coredns
|
|
|
|
|
SYSTEM:=
|
2017-10-30 15:55:41 +00:00
|
|
|
CHECKS:=check godeps
|
Makefile: add Windows target (#1199)
While we at it, why not add a target for Windows as well.
This also introduces a VERBOSE option that defaults to -v, but it empty
when releases so that you can actually see what you're building.
Move an @echo out of shell snippet into the Makefile, as that errored
with @echo: command not found.
Sample run and resulting artifacts:
~~~
% make -f Makefile.release build
% find build -type f -exec file {} \;
build/windows/amd64/coredns: PE32+ executable (console) x86-64 (stripped to external PDB), for MS Windows
build/darwin/amd64/coredns: Mach-O 64-bit x86_64 executable, flags:<NOUNDEFS>
build/linux/ppc64le/coredns: ELF 64-bit LSB executable, 64-bit PowerPC or cisco 7500, version 1 (SYSV), statically linked, stripped
build/linux/amd64/coredns: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, stripped
build/linux/arm/coredns: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, stripped
build/linux/s390x/coredns: ELF 64-bit MSB executable, IBM S/390, version 1 (SYSV), statically linked, stripped
build/linux/arm64/coredns: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), statically linked, stripped
% make -f Makefile.release tar
% find release -type f | sort
release/coredns_0.9.9_darwin_amd64.tgz
release/coredns_0.9.9_linux_amd64.tgz
release/coredns_0.9.9_linux_arm64.tgz
release/coredns_0.9.9_linux_arm.tgz
release/coredns_0.9.9_linux_ppc64le.tgz
release/coredns_0.9.9_linux_s390x.tgz
release/coredns_0.9.9_windows_amd64.tgz
~~~
2017-11-03 13:45:13 +00:00
|
|
|
VERBOSE:=-v
|
2016-06-06 12:49:53 -07:00
|
|
|
|
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: coredns
|
2017-10-30 15:55:41 +00:00
|
|
|
coredns: $(CHECKS)
|
2018-01-23 21:10:55 +01:00
|
|
|
CGO_ENABLED=0 $(SYSTEM) go build $(VERBOSE) -ldflags="-s -w -X github.com/coredns/coredns/coremain.GitCommit=$(GITCOMMIT)" -o $(BINARY)
|
2017-03-05 14:17:05 -08:00
|
|
|
|
|
|
|
|
.PHONY: check
|
2017-09-24 03:59:04 -07:00
|
|
|
check: linter core/zplugin.go core/dnsserver/zdirectives.go godeps
|
2016-04-28 11:07:44 -07:00
|
|
|
|
|
|
|
|
.PHONY: test
|
2017-03-05 14:17:05 -08:00
|
|
|
test: check
|
Makefile: add Windows target (#1199)
While we at it, why not add a target for Windows as well.
This also introduces a VERBOSE option that defaults to -v, but it empty
when releases so that you can actually see what you're building.
Move an @echo out of shell snippet into the Makefile, as that errored
with @echo: command not found.
Sample run and resulting artifacts:
~~~
% make -f Makefile.release build
% find build -type f -exec file {} \;
build/windows/amd64/coredns: PE32+ executable (console) x86-64 (stripped to external PDB), for MS Windows
build/darwin/amd64/coredns: Mach-O 64-bit x86_64 executable, flags:<NOUNDEFS>
build/linux/ppc64le/coredns: ELF 64-bit LSB executable, 64-bit PowerPC or cisco 7500, version 1 (SYSV), statically linked, stripped
build/linux/amd64/coredns: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, stripped
build/linux/arm/coredns: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, stripped
build/linux/s390x/coredns: ELF 64-bit MSB executable, IBM S/390, version 1 (SYSV), statically linked, stripped
build/linux/arm64/coredns: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), statically linked, stripped
% make -f Makefile.release tar
% find release -type f | sort
release/coredns_0.9.9_darwin_amd64.tgz
release/coredns_0.9.9_linux_amd64.tgz
release/coredns_0.9.9_linux_arm64.tgz
release/coredns_0.9.9_linux_arm.tgz
release/coredns_0.9.9_linux_ppc64le.tgz
release/coredns_0.9.9_linux_s390x.tgz
release/coredns_0.9.9_windows_amd64.tgz
~~~
2017-11-03 13:45:13 +00:00
|
|
|
go test -race $(VERBOSE) ./test ./plugin/...
|
2016-04-28 11:07:44 -07:00
|
|
|
|
2016-07-14 14:50:14 -07:00
|
|
|
.PHONY: testk8s
|
2017-03-05 14:17:05 -08:00
|
|
|
testk8s: check
|
Makefile: add Windows target (#1199)
While we at it, why not add a target for Windows as well.
This also introduces a VERBOSE option that defaults to -v, but it empty
when releases so that you can actually see what you're building.
Move an @echo out of shell snippet into the Makefile, as that errored
with @echo: command not found.
Sample run and resulting artifacts:
~~~
% make -f Makefile.release build
% find build -type f -exec file {} \;
build/windows/amd64/coredns: PE32+ executable (console) x86-64 (stripped to external PDB), for MS Windows
build/darwin/amd64/coredns: Mach-O 64-bit x86_64 executable, flags:<NOUNDEFS>
build/linux/ppc64le/coredns: ELF 64-bit LSB executable, 64-bit PowerPC or cisco 7500, version 1 (SYSV), statically linked, stripped
build/linux/amd64/coredns: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, stripped
build/linux/arm/coredns: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, stripped
build/linux/s390x/coredns: ELF 64-bit MSB executable, IBM S/390, version 1 (SYSV), statically linked, stripped
build/linux/arm64/coredns: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), statically linked, stripped
% make -f Makefile.release tar
% find release -type f | sort
release/coredns_0.9.9_darwin_amd64.tgz
release/coredns_0.9.9_linux_amd64.tgz
release/coredns_0.9.9_linux_arm64.tgz
release/coredns_0.9.9_linux_arm.tgz
release/coredns_0.9.9_linux_ppc64le.tgz
release/coredns_0.9.9_linux_s390x.tgz
release/coredns_0.9.9_windows_amd64.tgz
~~~
2017-11-03 13:45:13 +00:00
|
|
|
go test -race $(VERBOSE) -tags=k8s -run 'TestKubernetes' ./test ./plugin/kubernetes/...
|
2016-08-05 18:19:51 -07:00
|
|
|
|
2017-07-26 02:24:01 -07:00
|
|
|
.PHONY: godeps
|
|
|
|
|
godeps:
|
2018-01-10 12:52:02 -08:00
|
|
|
(cd $(GOPATH)/src/github.com/mholt/caddy 2>/dev/null && git checkout -q master 2>/dev/null || true)
|
|
|
|
|
(cd $(GOPATH)/src/github.com/miekg/dns 2>/dev/null && git checkout -q master 2>/dev/null || true)
|
|
|
|
|
(cd $(GOPATH)/src/github.com/prometheus/client_golang 2>/dev/null && git checkout -q master 2>/dev/null || true)
|
|
|
|
|
(cd $(GOPATH)/src/golang.org/x/net 2>/dev/null && git checkout -q master 2>/dev/null || true)
|
|
|
|
|
(cd $(GOPATH)/src/golang.org/x/text 2>/dev/null && git checkout -q master 2>/dev/null || true)
|
|
|
|
|
go get -u github.com/mholt/caddy
|
|
|
|
|
go get -u github.com/miekg/dns
|
|
|
|
|
go get -u github.com/prometheus/client_golang/prometheus/promhttp
|
|
|
|
|
go get -u github.com/prometheus/client_golang/prometheus
|
|
|
|
|
go get -u golang.org/x/net/context
|
|
|
|
|
go get -u golang.org/x/text
|
2018-01-10 09:30:28 -08:00
|
|
|
(cd $(GOPATH)/src/github.com/mholt/caddy && git checkout -q v0.10.10)
|
|
|
|
|
(cd $(GOPATH)/src/github.com/miekg/dns && git checkout -q v1.0.3)
|
|
|
|
|
(cd $(GOPATH)/src/github.com/prometheus/client_golang && git checkout -q v0.8.0)
|
|
|
|
|
(cd $(GOPATH)/src/golang.org/x/net && git checkout -q release-branch.go1.9)
|
|
|
|
|
(cd $(GOPATH)/src/golang.org/x/text && git checkout -q e19ae1496984b1c655b8044a65c0300a3c878dd3)
|
2017-06-03 08:27:41 +01:00
|
|
|
|
2017-08-19 17:02:16 +01:00
|
|
|
.PHONY: travis
|
|
|
|
|
travis: check
|
|
|
|
|
ifeq ($(TEST_TYPE),core)
|
2017-10-25 15:40:48 -04:00
|
|
|
( cd request ; go test -v -tags 'etcd' -race ./... )
|
|
|
|
|
( cd core ; go test -v -tags 'etcd' -race ./... )
|
|
|
|
|
( cd coremain go test -v -tags 'etcd' -race ./... )
|
2017-08-19 17:02:16 +01:00
|
|
|
endif
|
|
|
|
|
ifeq ($(TEST_TYPE),integration)
|
2017-10-25 15:40:48 -04:00
|
|
|
( cd test ; go test -v -tags 'etcd' -race ./... )
|
2017-08-19 17:02:16 +01:00
|
|
|
endif
|
2017-09-14 09:36:06 +01:00
|
|
|
ifeq ($(TEST_TYPE),plugin)
|
2017-10-25 15:40:48 -04:00
|
|
|
( cd plugin ; go test -v -tags 'etcd' -race ./... )
|
2017-08-19 17:02:16 +01:00
|
|
|
endif
|
|
|
|
|
ifeq ($(TEST_TYPE),coverage)
|
2016-09-26 14:22:48 +08:00
|
|
|
for d in `go list ./... | grep -v vendor`; do \
|
2017-08-19 12:18:56 -07:00
|
|
|
t=$$(date +%s); \
|
2017-10-25 15:40:48 -04:00
|
|
|
go test -i -tags 'etcd' -coverprofile=cover.out -covermode=atomic $$d || exit 1; \
|
|
|
|
|
go test -v -tags 'etcd' -coverprofile=cover.out -covermode=atomic $$d || exit 1; \
|
2017-08-19 12:18:56 -07:00
|
|
|
echo "Coverage test $$d took $$(($$(date +%s)-t)) seconds"; \
|
2016-09-27 07:57:04 +08:00
|
|
|
if [ -f cover.out ]; then \
|
|
|
|
|
cat cover.out >> coverage.txt; \
|
|
|
|
|
rm cover.out; \
|
2016-09-26 14:22:48 +08:00
|
|
|
fi; \
|
|
|
|
|
done
|
2017-08-19 17:02:16 +01:00
|
|
|
endif
|
|
|
|
|
|
2017-09-14 09:36:06 +01:00
|
|
|
core/zplugin.go core/dnsserver/zdirectives.go: plugin.cfg
|
2017-02-16 12:12:19 -05:00
|
|
|
go generate coredns.go
|
|
|
|
|
|
2017-01-31 12:25:02 -05:00
|
|
|
.PHONY: gen
|
|
|
|
|
gen:
|
2017-02-14 19:23:18 +00:00
|
|
|
go generate coredns.go
|
2017-01-31 12:25:02 -05:00
|
|
|
|
2017-09-24 03:59:04 -07:00
|
|
|
.PHONY: linter
|
|
|
|
|
linter:
|
|
|
|
|
go get -u github.com/alecthomas/gometalinter
|
|
|
|
|
gometalinter --install golint
|
|
|
|
|
gometalinter --deadline=1m --disable-all --enable=gofmt --enable=golint --enable=vet --exclude=^vendor/ --exclude=^pb/ ./...
|
2017-03-05 14:17:05 -08:00
|
|
|
|
2017-08-11 19:47:28 -07:00
|
|
|
.PHONY: clean
|
|
|
|
|
clean:
|
|
|
|
|
go clean
|
|
|
|
|
rm -f coredns
|