-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
43 lines (41 loc) · 1.32 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
BUILD_DATE := `date +%Y-%m-%d\ %H:%M`
VERSIONFILE := version.go
APP_VERSION := `bash ./generate_version.sh`
APP_NAME := "warmind-network"
PROFILE_BENCHMARK_NAME := "BenchmarkMaxLight"
#PROFILE_BENCHMARK_NAME := "BenchmarkFixupProfileFromProfileResponse"
all: build
easyjson:
easyjson -omit_empty -all bungie/*.go
genversion:
rm -f $(VERSIONFILE)
@echo "package main" > $(VERSIONFILE)
@echo "const (" >> $(VERSIONFILE)
@echo " version = \"$(APP_VERSION)\"" >> $(VERSIONFILE)
@echo " buildDate = \"$(BUILD_DATE)\"" >> $(VERSIONFILE)
@echo ")" >> $(VERSIONFILE)
build: genversion
go build
install: genversion
go install
test:
go test -v ./...
bench:
# Don't run regular tests as part of benchmarks
go test -v -bench=. -run=XXX ./...
profile:
go test -v -run=xxx -bench=$(PROFILE_BENCHMARK_NAME) -memprofile mem.out -cpuprofile cpu.out ./bungie
coverage:
## Right now the coverprofile option is not allowed when testing multiple packages.
## this is the best we can do for now until writing a bash script to loop over packages.
go test -cover ./...
# go test --coverprofile=coverage.out
# go tool cover -html=coverage.out
minimal: genversion
CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o warmind-network .
deploy: genversion
GOOS=linux GOARCH=amd64 go build
scp ./$(APP_NAME) li:
rm $(APP_NAME)
clean:
rm $(APP_NAME)