-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
49 lines (36 loc) · 1.01 KB
/
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
45
46
47
48
49
.PHONY: all usage vet lint test build clean monitfiles go.toolchain.rev go.toolchain.ver VERSION.txt
BLD := $(go build)
GIT_HASH := $(shell git rev-parse HEAD)
BASE_HASH := $(shell git rev-list --max-count=1 HEAD -- VERSION.txt)
CHANGE_COUNT := $(shell git rev-list --count HEAD)
VER := '0.$(CHANGE_COUNT)'
usage:
@echo "*** See Makefile for more details"
vet:
@echo "*** vet'ing go code..."
go vet ./...
@echo "*** ... done vet!\n"
lint:
@echo "*** lint'ing go code..."
golint ./...
@echo "*** ... done lint!\n"
test:
@echo "*** Testing..."
go test -v ./...
@echo "*** ... done tests!\n"
build: test monitfiles
@echo "*** ... done build!\n"
all: test vet lint monitfiles go.toolchain.ver go.toolchain.rev VERSION.txt
@echo "*** ... done all builds! \n"
clean:
@echo "*** Removing executables..."
rm monitfiles
@echo "*** ... done!\n"
monitfiles:
go build
go.toolchain.rev:
echo $(BASE_HASH) > go.toolchain.rev
go.toolchain.ver:
go version > go.toolchain.ver
VERSION.txt:
echo $(VER) > VERSION.txt