-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
46 lines (37 loc) · 1.16 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
WORKDIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
APP := yespower-go
REVISION := $(shell git rev-parse --short=8 HEAD)
TAG := $(shell git describe --tags --exact-match $(REVISION) 2>/dev/null)
GO111MODULE ?= auto
GOFLAGS ?= -mod=vendor
LDFLAGS := -ldflags "-s -w"
TEST_TOOL := go
ifneq (, $(shell which richgo))
TEST_TOOL := richgo
endif
.PHONY: all
all: build test
.PHONY: build
build:
$(info # #########################################################)
$(info #)
$(info # Building $(APP))
$(info #)
$(info # #########################################################)
GOOS=linux GOARCH=amd64 go build -o yespower $(LDFLAGS) yespower.go
.PHONY: test tests
test tests:
$(info # #########################################################)
$(info #)
$(info # Testing $(APP))
$(info #)
$(info # #########################################################)
$(TEST_TOOL) test -v
.PHONY: bench benchmark
bench benchmark:
$(info # #########################################################)
$(info #)
$(info # Benchmarking $(APP))
$(info #)
$(info # #########################################################)
$(TEST_TOOL) test -bench=Yes -benchtime 4s