-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathMakefile
More file actions
36 lines (28 loc) · 736 Bytes
/
Makefile
File metadata and controls
36 lines (28 loc) · 736 Bytes
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 ?= npd
BINDIR ?= $(DESTDIR)/usr/local/bin
ifndef $(GOLANG)
GOLANG=$(shell which go)
export GOLANG
endif
export GO111MODULE=on
export NOMAD_ADDR=http://localhost:4646
export NOMAD_E2E=1
GIT_VERSION?=$(shell git describe --always --dirty --tags)
GIT_COMMIT ?= $(shell git rev-parse HEAD)
BUILD_DATE ?= $(shell date +%s)
LDFLAGS += -X 'main.Timestamp=${BUILD_DATE}'
LDFLAGS += -X 'main.GitCommit=${GIT_COMMIT}'
LDFLAGS += -X 'main.GitVersion=${GIT_VERSION}'
default: build
.PHONY: clean
clean:
rm -f $(BINARY)
.PHONY: build
build:
$(GOLANG) build -ldflags "$(LDFLAGS)" -o $(BINARY) .
.PHONY: install
install: build
install -m 755 $(BINARY) $(BINDIR)/$(BINARY)
.PHONY: test
test:
$(GOLANG) test -count=1 -v ./...