-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Makefile
29 lines (22 loc) · 747 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
# vim:noet
BINARY=nedomi
SOURCES := $(shell find . -name '*.go')
VERSION = $(shell cat VERSION)
BUILD_TIME = $(shell date +%s)
GIT_HASH ?= $(shell git show --pretty=%h -s HEAD)
GIT_TAG ?= $(shell git name-rev --tags --no-undefined --name-only HEAD 2>/dev/null)
GIT_STATUS ?= $(shell git status --porcelain -uno)
ifneq "$(GIT_STATUS)" ""
DIRTY:=true
endif
LDFLAGS=-ldflags "-X main.Version=${VERSION} -X main.BuildTime=${BUILD_TIME} -X main.GitHash=${GIT_HASH} -X main.GitTag=${GIT_TAG} -X main.Dirty=${DIRTY}"
.DEFAULT_GOAL: $(BINARY)
default: ${BINARY}
${BINARY}: ${SOURCES}
go build ${LDFLAGS} -o ${BINARY} main.go
.PHONY: install
install:
go install ${LDFLAGS} ./...
.PHONY: clean
clean:
if [ -f ${BINARY} ] ; then rm ${BINARY} ; fi