-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
47 lines (35 loc) · 1.12 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
BINARY = gose
GOARCH = amd64
COMMIT=$(shell git rev-parse HEAD)
BRANCH=$(shell git rev-parse --abbrev-ref HEAD)
# Setup the -ldflags option for go build here, interpolate the variable values
LDFLAGS = -ldflags "-X main.VERSION=${BRANCH}:${COMMIT}"
GOCMD = GO111MODULE=on go
# Build the project
all: build
.PHONY: build
build: deps
${GOCMD} build ${LDFLAGS} -o ${BINARY} .
.PHONY: linux
linux: deps
GOOS=linux GOARCH=${GOARCH} ${GOCMD} build ${LDFLAGS} -o ${BINARY}-linux-${GOARCH} .
.PHONY: macos
macos: deps
GOOS=darwin GOARCH=${GOARCH} ${GOCMD} build ${LDFLAGS} -o ${BINARY}-macos-${GOARCH} .
.PHONY: windows
windows: deps
GOOS=windows GOARCH=${GOARCH} ${GOCMD} build ${LDFLAGS} -o ${BINARY}-windows-${GOARCH}.exe .
.PHONY: cross
cross: linux macos windows
.PHONY: deps
deps:
${GOCMD} get -v ./...
.PHONY: test
test: deps
${GOCMD} vet $$(go list ./... | grep -v /vendor/)
# The ci tag is used not to link to ebiten for the unit tests because
# ebiten requires a valid graphical environment at runtime even when not used
${GOCMD} test -v -race -tags ci ./...
.PHONY: fmt
fmt:
${GOCMD} fmt $$(go list ./... | grep -v /vendor/)