-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
75 lines (52 loc) · 2.01 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
71
72
73
74
75
BUILD_DIR = build
APP = deployer
CMD= cmd/deployer/main.go
APP_TOOL = secretSealer
CMD_TOOL= cmd/secretSealer/main.go
MC_DIR = build/bin
LOG_DIR= build/log
GIT_VER=$(shell git rev-parse HEAD)
LDFLAGS=-ldflags "-X main.version=${GIT_VER}"
.PHONY: dut app.darwin64 app.darwinArm lint clean distclean mrproper
# Build the project
help:
@echo "cmd:"
@echo ""
@echo " app build all app for all os"
@echo " app.darwin64 build app for osx64"
@echo " app.darwinArm build app for osx arm64"
@echo " app.linux64 build app for linux arm64"
@echo ""
@echo " lint go linter"
@echo ""
@echo " clean remove dut binarys"
@echo " distclean remove build folder"
all: app tool
app: app.windows app.windows64 app.darwin64 app.darwinArm app.linux64
app.windows:
GOOS=windows GOARCH=386 go build ${LDFLAGS} -o ${BUILD_DIR}/${APP}.exe -v ${CMD}
app.windows64:
GOOS=windows GOARCH=amd64 go build ${LDFLAGS} -o ${BUILD_DIR}/${APP}64.exe -v ${CMD}
app.darwin64:
GOOS=darwin GOARCH=amd64 go build ${LDFLAGS} -o ${BUILD_DIR}/${APP}-darwin -v ${CMD}
app.darwinArm:
GOOS=darwin GOARCH=arm64 go build ${LDFLAGS} -o ${BUILD_DIR}/${APP}-darwin-arm -v ${CMD}
app.linux64:
GOOS=linux GOARCH=amd64 go build ${LDFLAGS} -o ${BUILD_DIR}/${APP}-linux -v ${CMD}
tool: tool.windows tool.windows64 tool.darwin64 tool.darwinArm tool.linux64
tool.windows:
GOOS=windows GOARCH=386 go build ${LDFLAGS} -o ${BUILD_DIR}/${APP_TOOL}.exe -v ${CMD_TOOL}
tool.windows64:
GOOS=windows GOARCH=amd64 go build ${LDFLAGS} -o ${BUILD_DIR}/${APP_TOOL}64.exe -v ${CMD_TOOL}
tool.darwin64:
GOOS=darwin GOARCH=amd64 go build ${LDFLAGS} -o ${BUILD_DIR}/${APP_TOOL}-darwin -v ${CMD_TOOL}
tool.darwinArm:
GOOS=darwin GOARCH=arm64 go build ${LDFLAGS} -o ${BUILD_DIR}/${APP_TOOL}-darwin-arm -v ${CMD_TOOL}
tool.linux64:
GOOS=linux GOARCH=amd64 go build ${LDFLAGS} -o ${BUILD_DIR}/${APP_TOOL}-linux -v ${CMD_TOOL}
lint:
golint -set_exit_status $(shell go list ./...)
clean:
-rm -f ${BUILD_DIR}/${DUT}-*
distclean:
rm -rf ./build