-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
33 lines (33 loc) · 1.58 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
version := 0.1.0
curDir := $(shell pwd)
date := $(shell date +%Y%m%d-%H:%M:%S)
githash := $(shell git log -1 --format="%h")
gitbranch := $(shell git rev-parse --abbrev-ref HEAD)
####
toDev: buildAllLinux scpAllDev scpDevConfig
##################
.PHONY: buildAll buildAllLinux scpDevConfig scpAllDev buildAdmin buildAdminLinux
buildAll:
@echo "build all......"
@(cd ${curDir}/cmd/all;\
go build -v -ldflags "-X main.version=$(version) -X main.githash=$(githash) -X main.buildtime=$(date) -X main.branch=$(gitbranch)" -o ${curDir}/bin/all)
buildAllLinux:
@echo "build all linux......"
@(cd ${curDir}/cmd/all;\
GOOS=linux GOARCH=amd64 go build -v -ldflags "-X main.version=$(version) -X main.githash=$(githash) -X main.buildtime=$(date) -X main.branch=$(gitbranch)" -o ${curDir}/bin/all)
buildAdmin:
@echo "build admin......"
@(cd ${curDir}/cmd/admin;\
go build -v -ldflags "-X main.version=$(version) -X main.githash=$(githash) -X main.buildtime=$(date) -X main.branch=$(gitbranch)" -o ${curDir}/bin/admin)
buildAdminLinux:
@echo "build admin linux......"
@(cd ${curDir}/cmd/admin;\
GOOS=linux GOARCH=amd64 go build -v -ldflags "-X main.version=$(version) -X main.githash=$(githash) -X main.buildtime=$(date) -X main.branch=$(gitbranch)" -o ${curDir}/bin/admin)
scpAllDev:
@echo "scp All to dev......"
#@(ssh [email protected] "mv ~/bbb/config/dev.yaml ~/bbb/config/dev.yaml.bak")
@(scp bin/all [email protected]:~/bbb/bin/)
scpDevConfig:
@echo "scp dev.yaml......"
@(ssh [email protected] "mv ~/bbb/config/dev.yaml ~/bbb/config/dev.yaml.bak")
@(scp config/dev.yaml [email protected]:~/bbb/config/dev.yaml)