This repository has been archived by the owner on Jun 13, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathMakefile
70 lines (53 loc) · 2.02 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
63
64
65
66
67
68
69
70
KUBICD_BIN := bin/kubicd
KUBICCTL_BIN := bin/kubicctl
HAPROXYCFG_BIN := bin/haproxycfg
GO ?= go
GO_MD2MAN ?= go-md2man
VERSION := $(shell cat VERSION)
PORT := $(shell cat PORT)
USE_VENDOR =
LOCAL_LDFLAGS = -buildmode=pie -ldflags "-X=main.Version=$(VERSION) \
-X=main.port=$(PORT)\
-X=github.com/thkukuk/kubic-control/pkg/kubicctl.Version=$(VERSION) \
-X=github.com/thkukuk/kubic-control/pkg/kubicctl.port=$(PORT)"
.PHONY: all api build vendor
all: api dep build
api: ## Auto-generate grpc go sources
@protoc -I api/ \
--go_out=plugins=grpc:api \
api/api.proto
dep: api ## Get the dependencies
@$(GO) get -v -d ./...
update: api ## Get and update the dependencies
@$(GO) get -v -d -u ./...
tidy: ## Clean up dependencies
@$(GO) mod tidy
vendor: dep ## Create vendor directory
@$(GO) mod vendor
build: ## Build the binary files
$(GO) build -v -o $(KUBICD_BIN) $(USE_VENDOR) $(LOCAL_LDFLAGS) ./cmd/kubicd
$(GO) build -v -o $(KUBICCTL_BIN) $(USE_VENDOR) $(LOCAL_LDFLAGS) ./cmd/kubicctl
$(GO) build -v -o $(HAPROXYCFG_BIN) $(USE_VENDOR) $(LOCAL_LDFLAGS) ./cmd/haproxycfg
clean: ## Remove previous builds
@rm -f $(KUBICD_BIN) $(KUBICCTL_BIN) $(API_GO)
help: ## Display this help screen
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
.PHONY: release
release: ## create release package from git
git clone https://github.com/thkukuk/kubic-control
mv kubic-control kubic-control-$(VERSION)
rm -rf kubic-control-$(VERSION)/.git*
sed -i -e 's|USE_VENDOR =|USE_VENDOR = -mod vendor|g' kubic-control-$(VERSION)/Makefile
make -C kubic-control-$(VERSION) api
make -C kubic-control-$(VERSION) vendor
tar cJf kubic-control-$(VERSION).tar.xz kubic-control-$(VERSION)
rm -rf kubic-control-$(VERSION)
#MANPAGES_MD := $(wildcard docs/man/*.md)
#MANPAGES := $(MANPAGES_MD:%.md=%)
#docs/man/%.1: docs/man/%.1.md
# $(GO_MD2MAN) -in $< -out $@
#.PHONY: docs
#docs: $(MANPAGES)
#.PHONY: install
#install:
# $(GO) install $(LOCAL_LDFLAGS) ./cmd/...