-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
20 lines (10 loc) · 926 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
compile_time=$(shell date +%Y/%m/%d-%H:%M:%S)
version=$(shell go version | awk '{print $$3}')
branch=$(shell git branch | grep '*' | awk '{print $$2}')
commit=$(shell git log | grep commit | head -n 1 | awk '{print $$2}')
debug:
@go build -race -gcflags="-N -l" -ldflags="-X github.com/Hurricanezwf/rate-limiter/version.GoVersion=$(version) -X github.com/Hurricanezwf/rate-limiter/version.Branch=$(branch) -X github.com/Hurricanezwf/rate-limiter/version.Commit=$(commit) -X github.com/Hurricanezwf/rate-limiter/version.CompileTime=$(compile_time)"
release:
@export CGO_ENABLED=0 && go build -ldflags="-w -s -X github.com/Hurricanezwf/rate-limiter/version.GoVersion=$(version) -X github.com/Hurricanezwf/rate-limiter/version.Branch=$(branch) -X github.com/Hurricanezwf/rate-limiter/version.Commit=$(commit) -X github.com/Hurricanezwf/rate-limiter/version.CompileTime=$(compile_time)"
clean:
@rm -f ./rate-limiter