-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathMakefile
46 lines (35 loc) · 1.38 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
GOFILES := $(shell find . -name '*.go' | grep -v -E '(./vendor)')
BIN := $(shell basename $(CURDIR))
# PLATFORM := $(shell go env GOOS)
PLATFORM := linux
AnsibleinitPath := cmd/installer/ssh/ansibleinit.go
OperatorPath := cmd/kube-operator/app.go
# ifneq (PLATFORM, "windows")
# PLATFORM = linux
# endif
.DEFAULT_GOAL := default
default: $(PLATFORM)
all: linux darwin windows
linux: output/$(BIN)
darwin: output/$(BIN)
windows: output/$(BIN)
.PHONY: images
images:
mkdir -p output
GO111MODULE=on GOPROXY=https://mirrors.aliyun.com/goproxy/ GOOS=$(PLATFORM) GOARCH=amd64 go build -ldflags "$(LDFLAGS)" -o output/ansibleinit $(AnsibleinitPath)
docker build --no-cache -f build/ansible/Dockerfile -t ansibleinit .
GO111MODULE=on GOPROXY=https://mirrors.aliyun.com/goproxy/ GOOS=$(PLATFORM) GOARCH=amd64 go build -ldflags "$(LDFLAGS)" -o output/kubernetes-operator $(OperatorPath)
docker build --no-cache -f build/kube-operator/Dockerfile -t kubernetes-operator .
@rm -rf output
check:
@find . -name vendor -prune -o -name '*.go' -exec gofmt -s -d {} +
@go vet $(shell go list ./... | grep -v '/vendor/')
@go test -v $(shell go list ./... | grep -v '/vendor/')
vendor:
dep ensure
clean:
@rm -rf output
output/%: LDFLAGS=-s -w
output/%: $(GOFILES)
mkdir -p $(dir $@)
GO111MODULE=on GOPROXY=https://mirrors.aliyun.com/goproxy/ GOOS=$(PLATFORM) GOARCH=amd64 go build -ldflags "$(LDFLAGS)" -o $@