This repository has been archived by the owner on Aug 31, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile-agent
59 lines (47 loc) · 1.97 KB
/
Makefile-agent
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
VERSION=1.0.0
PROJECT=utl-agent
PACKAGE=${PROJECT}-${VERSION}
BINARY=utl-agent
BIN_DIR=bin
BIN_ZIP_DIR=${BIN_DIR}/zip/${PROJECT}/${VERSION}/
BIN_ZIP_RELAT=../../../zip/${PROJECT}/${VERSION}/
BIN_OUT=${BIN_DIR}/${PROJECT}/${VERSION}/
BIN_WIN64=${BIN_OUT}win64/utl-agent/
BIN_WIN32=${BIN_OUT}win32/utl-agent/
BIN_LINUX=${BIN_OUT}linux/utl-agent/
BIN_MAC=${BIN_OUT}mac/utl-agent/
default: prepare_res compile_all copy_files package
win64: prepare_res compile_win64 copy_files package
win32: prepare_res compile_win32 copy_files package
linux: prepare_res compile_linux copy_files package
mac: prepare_res compile_mac copy_files package
prepare_res:
@echo 'start prepare res'
@go-bindata -o=res/agent/res.go -pkg=agentRes res/agent/...
@rm -rf ${BIN_DIR}
compile_all: compile_win64 compile_win32 compile_linux compile_mac
compile_win64:
@echo 'start compile win64'
@CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o ${BIN_WIN64}utl-agent.exe src/main.go
compile_win32:
@echo 'start compile win32'
@CGO_ENABLED=0 GOOS=windows GOARCH=386 go build -o ${BIN_WIN32}utl-agent.exe src/main.go
compile_linux:
@echo 'start compile linux'
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o ${BIN_LINUX}utl-agent src/main.go
compile_mac:
@echo 'start compile mac'
@CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o ${BIN_MAC}utl-agent src/main.go
copy_files:
@echo 'start copy files'
@cp -r {cmd/server/server.yml,cmd/server/perms.yml,cmd/server/rbac_model.conf} bin
@for subdir in `ls ${BIN_OUT}`;
do cp -r {bin/server.yml,bin/perms.yml,bin/rbac_model.conf} "${BIN_OUT}$${subdir}/utl-agent"; done
package:
@echo 'start package'
@find . -name .DS_Store -print0 | xargs -0 rm -f
@for subdir in `ls ${BIN_OUT}`; do mkdir -p ${BIN_DIR}/zip/${PROJECT}/${VERSION}/$${subdir}; done
@cd ${BIN_OUT} && \
for subdir in `ls ./`; do cd $${subdir} && zip -r ${BIN_ZIP_RELAT}$${subdir}/${BINARY}.zip "${BINARY}" && cd ..; done
#@cd ${BIN_ZIP_DIR} && zip -r ${PACKAGE}.zip ./
#@cd ${BIN_DIR} && rm -rf ${PROJECT}