-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
53 lines (42 loc) · 1.34 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
GOPATH:=$(PWD):${GOPATH}
export GOPATH
OS := $(shell uname)
ifeq ($(OS),Darwin)
flags=-ldflags="-s -w"
else
flags=-ldflags="-s -w -extldflags -static"
endif
TAG := $(shell git tag | sort -r | head -n 1)
all: build
build:
sed -i -e "s,{{VERSION}},$(TAG),g" main.go
go clean; rm -rf pkg transfer2go*; go build ${flags}
sed -i -e "s,$(TAG),{{VERSION}},g" main.go
build_all: build build_osx build_linux build_power8 build_arm64
build_osx:
sed -i -e "s,{{VERSION}},$(TAG),g" main.go
go clean; rm -rf pkg transfer2go_osx; GOOS=darwin go build ${flags}
sed -i -e "s,$(TAG),{{VERSION}},g" main.go
mv transfer2go transfer2go_osx
build_linux:
sed -i -e "s,{{VERSION}},$(TAG),g" main.go
go clean; rm -rf pkg transfer2go_linux; GOOS=linux go build ${flags}
sed -i -e "s,$(TAG),{{VERSION}},g" main.go
mv transfer2go transfer2go_linux
build_power8:
sed -i -e "s,{{VERSION}},$(TAG),g" main.go
go clean; rm -rf pkg transfer2go_power8; GOARCH=ppc64le GOOS=linux go build ${flags}
sed -i -e "s,$(TAG),{{VERSION}},g" main.go
mv transfer2go transfer2go_power8
build_arm64:
sed -i -e "s,{{VERSION}},$(TAG),g" main.go
go clean; rm -rf pkg transfer2go_arm64; GOARCH=arm64 GOOS=linux go build ${flags}
sed -i -e "s,$(TAG),{{VERSION}},g" main.go
mv transfer2go transfer2go_arm64
install:
go install
clean:
go clean; rm -rf pkg
test : test1
test1:
cd test; go test