-
Notifications
You must be signed in to change notification settings - Fork 34
/
Makefile
36 lines (26 loc) · 855 Bytes
/
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
BINARY = enterbj
GOARCH = amd64
VERSION= 0.1.0
BUILD = `date +%FT%T%z`
LDFLAGS= -ldflags "-X main.Version=${VERSION} -X main.Build=${BUILD}"
.PHONY: help build linux darwin windows clean
help:
@echo "usage: make <option>"
@echo "options and effects:"
@echo " build : build the binary"
@echo " linux : build the linux binary"
@echo " darwin : build the darwin binary"
@echo " windows: build the windows binary"
@echo " clean : clean binary"
all: linux darwin windows
build:
@go build ${LDFLAGS} -o ${BINARY}
linux:
@GOOS=linux GOARCH=${GOARCH} go build ${LDFLAGS} -o ${BINARY}-linux-${GOARCH}
darwin:
@GOOS=darwin GOARCH=${GOARCH} go build ${LDFLAGS} -o ${BINARY}-darwin-${GOARCH}
windows:
@GOOS=windows GOARCH=${GOARCH} go build ${LDFLAGS} -o ${BINARY}-windows-${GOARCH}
clean:
@rm -f ${BINARY}
@rm -f ${BINARY}-*