-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
44 lines (32 loc) · 885 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
37
38
39
40
41
42
43
44
NAME = client
BRANCH = $(shell git rev-parse --abbrev-ref HEAD)
COMMIT = $(shell git rev-parse --short HEAD)
BUILDTIME = $(shell date +%Y-%m-%dT%T%z)
GOPATH = $(shell echo "$$GOPATH")
WD = $(shell pwd)
LD_OPTS = -ldflags="-X main.branch=${BRANCH} -X main.commit=${COMMIT} -X main.lasttag=${LASTTAG} -X main.buildtime=${BUILDTIME} -w "
all: build run
all-with-deps: setup deps build
run: build
cd $(WD)/cmd && ./$(NAME) && ../
# run:
# ./$(NAME)
setup:
go get -u github.com/kardianos/govendor
deps:
govendor sync -v
build:
cd $(WD)/cmd && go build $(LD_OPTS) -o $(NAME) .
# Show to-do items per file.
todo:
@grep \
--exclude-dir=vendor \
--exclude=Makefile \
--text \
--color \
-nRo -E ' TODO:.*|SkipNow|nolint:.*' .
.PHONY: todo
dist:
GOOS=linux GOARCH=amd64 go build $(LD_OPTS) -o $(NAME) .
test:
GOOS=linux GOARCH=amd64 go build $(LD_OPTS) -o test .