-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
34 lines (26 loc) · 953 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
BINARY := uniname
VERSION := $(shell git describe --tags --abbrev=0 2>/dev/null || (git describe --always --long --dirty|tr '\n' '-';date +%Y.%m.%d))
LDFLAGS = -ldflags "-w -s -X main.version=${VERSION}"
LDFLAGS_DEV = -ldflags "-X main.version=${VERSION}"
MMAKE := $(shell command -v mmake 2> /dev/null)
GOX := $(shell command -v gox 2> /dev/null)
help:
ifndef MMAKE
$(error "mmake is not available. Please install from https://github.com/tj/mmake ")
endif
@mmake help
gox:
ifndef GOX
$(error "gox is not available. Please install from https://github.com/mitchellh/gox ")
endif
#Build release builds
release: gox
@gox -osarch="darwin/386 darwin/amd64 linux/386 linux/amd64 windows/386 windows/amd64" ${LDFLAGS} -output="bin/{{.Dir}}_{{.OS}}_{{.Arch}}"
#Build a development build
dev:
@go build ${LDFLAGS_DEV} -o bin/${BINARY}
#Install a release build on your local system
install: clean
@go install ${LDFLAGS}
clean:
@go clean -i