-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
123 lines (104 loc) · 2.74 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#GOPATH:=$(PWD):${GOPATH}
#export GOPATH
flags=-ldflags="-s -w"
# flags=-ldflags="-s -w -extldflags -static"
TAG := $(shell git tag | sed -e "s,v,," | sort -r | head -n 1)
all: golib build
golib:
./get_golib.sh
gorelease:
goreleaser release --snapshot --clean
build:
ifdef TAG
sed -i -e "s,{{VERSION}},$(TAG),g" main.go
endif
go clean; rm -rf pkg; go build -o srv ${flags}
ifdef TAG
sed -i -e "s,$(TAG),{{VERSION}},g" main.go
endif
build_all: golib build_darwin_amd64 build_darwin_arm64 build_amd64 build_amd64_static build_arm64 build_power8 build_windows_amd64 build_windows_arm64 changes
build_darwin_amd64:
ifdef TAG
sed -i -e "s,{{VERSION}},$(TAG),g" main.go
endif
go clean; rm -rf pkg srv_darwin; GOOS=darwin go build -o srv ${flags}
mv srv srv_darwin_amd64
ifdef TAG
sed -i -e "s,$(TAG),{{VERSION}},g" main.go
endif
build_darwin_arm64:
ifdef TAG
sed -i -e "s,{{VERSION}},$(TAG),g" main.go
endif
go clean; rm -rf pkg srv_darwin; GOARCH=arm64 GOOS=darwin go build -o srv ${flags}
mv srv srv_darwin_arm64
ifdef TAG
sed -i -e "s,$(TAG),{{VERSION}},g" main.go
endif
build_amd64:
ifdef TAG
sed -i -e "s,{{VERSION}},$(TAG),g" main.go
endif
go clean; rm -rf pkg srv_linux; GOOS=linux go build -o srv ${flags}
mv srv srv_amd64
ifdef TAG
sed -i -e "s,$(TAG),{{VERSION}},g" main.go
endif
build_amd64_static:
ifdef TAG
sed -i -e "s,{{VERSION}},$(TAG),g" main.go
endif
go clean; rm -rf pkg srv_linux; CGO_ENABLED=0 GOOS=linux go build -tags static -o srv ${flags}
mv srv srv_amd64_static
ifdef TAG
sed -i -e "s,$(TAG),{{VERSION}},g" main.go
endif
build_power8:
ifdef TAG
sed -i -e "s,{{VERSION}},$(TAG),g" main.go
endif
go clean; rm -rf pkg srv_power8; GOARCH=ppc64le GOOS=linux go build -o srv ${flags}
ifdef TAG
sed -i -e "s,$(TAG),{{VERSION}},g" main.go
endif
mv srv srv_power8
build_arm64:
ifdef TAG
sed -i -e "s,{{VERSION}},$(TAG),g" main.go
endif
go clean; rm -rf pkg srv_arm64; GOARCH=arm64 GOOS=linux go build -o srv ${flags}
ifdef TAG
sed -i -e "s,$(TAG),{{VERSION}},g" main.go
endif
mv srv srv_arm64
build_windows_amd64:
ifdef TAG
sed -i -e "s,{{VERSION}},$(TAG),g" main.go
endif
go clean; rm -rf pkg srv.exe; GOARCH=amd64 GOOS=windows go build -o srv.exe ${flags}
ifdef TAG
sed -i -e "s,$(TAG),{{VERSION}},g" main.go
endif
mv srv.exe srv_amd64.exe
build_windows_arm64:
ifdef TAG
sed -i -e "s,{{VERSION}},$(TAG),g" main.go
endif
go clean; rm -rf pkg srv.exe; GOARCH=arm64 GOOS=windows go build -o srv.exe ${flags}
ifdef TAG
sed -i -e "s,$(TAG),{{VERSION}},g" main.go
endif
mv srv.exe srv_arm64.exe
install:
go install
clean:
go clean; rm -rf pkg
changes:
./changes.sh
./last_changes.sh
test: test_code
test_code:
touch ~/.foxden.yaml
go test -test.v .
# here is an example for execution of individual test
# go test -v -run TestFilesDB