-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathMakefile
More file actions
44 lines (36 loc) · 1.45 KB
/
Makefile
File metadata and controls
44 lines (36 loc) · 1.45 KB
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
# makefile for cloudcli
# build with git revision number
# example: gb build -ldflags "-X main.build=`git rev-parse HEAD`" cmd/cloudcli
# varible
GB = gb
CURRENT_REVISION = `git rev-parse HEAD`
LD_FLAGS := "-X main.build=$(CURRENT_REVISION)"
TARGET_CLOUDCLI = cmd/cloudcli
BIN_CLOLUDCLI = ./bin/cloudcli
RELEASE_DIR = ./release
# target
all: cli
# release
release:
@echo "[begin] release ==================="
GOOS=darwin GOARCH=amd64 $(GB) build -ldflags "-X main.build=`git rev-parse HEAD`" $(TARGET_CLOUDCLI)
GOOS=linux GOARCH=amd64 $(GB) build -ldflags "-X main.build=`git rev-parse HEAD`" $(TARGET_CLOUDCLI)
GOOS=windows GOARCH=amd64 $(GB) build -ldflags "-X main.build=`git rev-parse HEAD`" $(TARGET_CLOUDCLI)
tar czvf release.tar.gz ./bin/cloudcli-darwin-amd64 ./bin/cloudcli-windows-amd64.exe ./bin/cloudcli-linux-amd64
@echo "[end] release ==================="
cli: clean
@echo "[begin] build cloudcli ==================="
$(GB) build -ldflags "-X main.build=`git rev-parse HEAD`" $(TARGET_CLOUDCLI)
@echo "[end ] build cloudcli ==================="
.PHONY: clean
clean:
rm -f $(BIN_CLOLUDCLI)
help:
@echo "make [option]: "
@echo "\t all : compile for all binaries(cloudcli)"
@echo "\t release : generate tar file with compiled binary(windows, linux, osx)"
@echo "\t cli : compile for cloudcli"
@echo "\t clean : clean files which are generated by compile"
@echo "\t help : print this help info"
@echo "\n"
@echo "make == make all"