-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
51 lines (40 loc) · 1.09 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
APP?=s3benchmark
BUILDDATE=$(shell date +'%Y-%m-%dT%H:%M:%SZ')
VERSION=2.2.3
LONGVER=${VERSION}@${BUILDDATE}
LDFLAGS=-ldflags "-s -w -X main.version=${LONGVER}"
.DEFAULT_GOAL:=default
## pkg: build and package the app
.PHONY: pkg
pkg:
@echo "Building Linux amd64 ${APP}-${VERSION}"
GOOS=linux GOARCH=amd64 go build ${LDFLAGS}
zip -m ${APP}-${VERSION}-linux.zip ${APP}
@echo "Building Macos amd64 ${APP}-${VERSION}"
GOOS=darwin GOARCH=amd64 go build ${LDFLAGS}
zip -m ${APP}-${VERSION}-macos.zip ${APP}
@echo "Building Windows amd64 ${APP}-${VERSION}"
GOOS=windows GOARCH=amd64 go build ${LDFLAGS}
zip -m ${APP}-${VERSION}-win.zip ${APP}.exe
## test: runs go test with default values
.PHONY: test
test:
go test ./...
## vet: runs go vet
.PHONY: vet
vet:
go vet ./...
## default: build the app
.PHONY: default
default:
@echo "Building ${APP}-${VERSION}"
go build ${LDFLAGS}
## clean: cleans the build results
.PHONY: clean
clean:
rm -rf *zip ${APP}
## help: prints this help message
.PHONY: help
help:
@echo "Usage: \n"
@sed -n 's/^##//p' ${MAKEFILE_LIST} | column -t -s ':' | sed -e 's/^/ /'