Files
coredns/Makefile

90 lines
3.3 KiB
Makefile
Raw Normal View History

# Makefile for building CoreDNS
GITCOMMIT:=$(shell git describe --dirty --always)
BINARY:=coredns
SYSTEM:=
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
BK8s datasource middleware -- PoC for A records (#153) * Laying down kubernetes middleware foundation * Duplicated a bunch of code form etcd middleware * Duplicated code hacked to compile and load as a separate middleware * Adding verbose build option to Makefile * Removing stubzone and tls support tls and stubzone support was carried over from base etcd middleware code. Removing to simplify the kube middleware implementation. (For now.) * Adding conf directory for sample conf files * Removing stubzone support from query handler * Remove upstream and proxy from k8s corefile. Not sure that upstream or proxy makes sense for a k8s backed zone. * Comment out use of singleflight serialization * Removing parsing support for "upstream" directive from k8s * Removing upstream directive parsing code * Removing CNAME and TXT lookup implementation * Create README.md Brain-dump of DNS record name assembly and open work items. * Adding notes about wildcard handling * Adding basic k8s API client * Fleshing out methods on k8s connector * Remove PathPrefix from middleware init * Removing incorrect plural * Adding brute-force k8s service lookup functions * Initializing k8s API connector during startup * Hacking around to call k8s connector * Parsing incoming domain name into serviceName and namespace * Improving and simplifying k8s zone matching and label segmentation * Removing unused functions carried over from etcd middleware * Adding basic return of k8s data to DNS client * updated debugging println statements to flag with "[debug]" * removed code in kubernetes.go::Records that was a hold-over from etcd middleware. * Removed some random exploratory hacking. * Minior README.md updates * Updating with demo instructions * Updating README.md with CoreFile and removing completed TODO items * Updating conf file and README to reflect DNS response cache works * Disabling DNS response caching * Adding debug statement on entry to Records() * Changing port number in exampes to port 53. * Misc style and clarity changes * Removing empty function definitions * Adding comment to track future cleanup * Refactoring README to follow style of other middleware * Exposing dataobject field (typo)
2016-06-06 12:49:53 -07:00
all: coredns
.PHONY: coredns
coredns: $(CHECKS)
CGO_ENABLED=0 $(SYSTEM) go build $(VERBOSE) -ldflags="-s -w -X github.com/coredns/coredns/coremain.GitCommit=$(GITCOMMIT)" -o $(BINARY)
.PHONY: check
check: linter core/zplugin.go core/dnsserver/zdirectives.go godeps
.PHONY: test
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/...
Adding wildcard support (#190) * Commenting out unused functions. TODO: remove when it is not needed * Update README with namespace and template example * Adding note about changing the record name format via a template * Adding test scripts to automate k8s startup * Automating k8s namespace creation * Adding automation to start 4 k8s services * Updating documentation for k8s tests * Avoid downloading kubectl if already exists * Adding debug statement when namespace is not exposed. * Adding basic kubernetes integration tests * Makefile now contains a "testk8s" target. This target requires k8s to be running. * Adding test/kubernetes_test.go file with a couple of basic A record tests. * Updating k8s integration tests to only run k8s integration tests * Adding support for namespace wildcards * Refactoring to move filtering logic to kubernetes.go file * go fmt fixes * Adding wildcard support for namespaces and service names * Kubernetes integration tests updated for A records. * Expanded record name assembly for answer section not yet implemented. * Refactoring to focus k8sclient code just on accessing k8s API. Filtering now handled in kubernetes.go * Adding wildcard test cases * Adding skydns startup script. (To allow side by side testing of wildcards.) * Commenting out record name assmebly based on NameTemplate. Need to improve template before this makes sense. * Adding basic SRV integration tests * Need to add verification for additional answer section * Fixing comments and formatting * Moving wildcard constants to vars * Travis test execution appears to be failing on access to these constants * Fixing access to util package * Trying to work around Travis test bug * Reverting to access kubernetes/util as "util" Travis breakage is due to "Infoblox-CTO" in src path
2016-07-14 14:50:14 -07:00
.PHONY: testk8s
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/...
.PHONY: godeps
godeps:
(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)
(cd $(GOPATH)/src/github.com/coredns/forward 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
go get -u github.com/coredns/forward
(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.4)
(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)
(cd $(GOPATH)/src/github.com/coredns/forward && git checkout -q v0.0.2)
.PHONY: travis
travis: check
ifeq ($(TEST_TYPE),core)
( cd request ; go test -v -tags 'etcd' -race ./... )
( cd core ; go test -v -tags 'etcd' -race ./... )
( cd coremain go test -v -tags 'etcd' -race ./... )
endif
ifeq ($(TEST_TYPE),integration)
( cd test ; go test -v -tags 'etcd' -race ./... )
endif
ifeq ($(TEST_TYPE),plugin)
( cd plugin ; go test -v -tags 'etcd' -race ./... )
endif
ifeq ($(TEST_TYPE),coverage)
for d in `go list ./... | grep -v vendor`; do \
t=$$(date +%s); \
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; \
echo "Coverage test $$d took $$(($$(date +%s)-t)) seconds"; \
if [ -f cover.out ]; then \
cat cover.out >> coverage.txt; \
rm cover.out; \
fi; \
done
endif
core/zplugin.go core/dnsserver/zdirectives.go: plugin.cfg
go generate coredns.go
.PHONY: gen
gen:
go generate coredns.go
.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/ ./...
.PHONY: clean
clean:
go clean
rm -f coredns