forked from tiglabs/containerdns
-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
64 lines (42 loc) · 1.98 KB
/
makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/env bash
SRCFILES=main.go $(wildcard utils/*.go) $(wildcard dns-server/*.go) $(wildcard backends/*.go) $(wildcard queue/*.go)
#VERSION?=$(shell git describe --tags)
VERSION?=$(shell git rev-parse HEAD)
# Ensure that the dist directory is always created
MAKE_SURE_DIST_EXIST := $(shell mkdir -p dist)
GO_CONTAINER_NAME?=dockerepo/glide
GOPATH=${PWD}/../../../../
.PHONY: all binary
default: all
all: binary kubeapi scanner schedule
binary: dist/containerdns
kubeapi: dist/kubeapi
scanner: dist/dns-scanner
schedule: dist/dns-schedule
docker-image: $(DEPLOY_CONTAINER_MARKER)
.PHONY: clean
clean:
rm -rf dist vendor $(DEPLOY_CONTAINER_MARKER)
vendor: glide.yaml
docker run --rm \
-v ${HOME}/.glide:/root/.glide:rw \
-v ${PWD}:/go/src/github.com/tiglabs/containerdns:rw \
--entrypoint /bin/sh $(GO_CONTAINER_NAME) -e -c ' \
cd /go/src/github.com/tiglabs/containerdns && \
glide install -strip-vendor && \
chown $(shell id -u):$(shell id -u) -R vendor'
dist/containerdns: $(SRCFILES) vendor
GOPATH=${GOPATH} CGO_ENABLED=1 go build -v -o dist/containerdns \
-ldflags "-X main.VERSION=$(VERSION) -s -w" main.go
KUBEAPISRC=containerdns-kubeapi/api.go containerdns-kubeapi/server.go
dist/kubeapi: $(KUBEAPISRC) vendor
GOPATH=${GOPATH} CGO_ENABLED=1 go build -v -o dist/containerdns-kubeapi \
-ldflags "-X main.VERSION=$(VERSION) -s -w" containerdns-kubeapi/*.go
SCANNERSRC=dns-scanner/scanner.go $(wildcard dns-scanner/ev2/*.go)
dist/dns-scanner: $(SCANNERSRC) vendor
GOPATH=${GOPATH} CGO_ENABLED=1 go build -v -o dist/dns-scanner \
-ldflags "-X main.VERSION=$(VERSION) -s -w" dns-scanner/scanner.go
SCHEDULESRC=dns-schedule/schedule.go $(wildcard dns-scanner/base/*.go) $(wildcard dns-scanner/domain/*.go) $(wildcard dns-scanner/ipaddr/*.go)
dist/dns-schedule: $(SCHEDULESRC) vendor
GOPATH=${GOPATH} CGO_ENABLED=1 go build -v -o dist/dns-schedule \
-ldflags "-X main.VERSION=$(VERSION) -s -w" dns-schedule/schedule.go