-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
36 lines (25 loc) · 772 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
# full pkg name
PKG = gin-data-checker
# Binary
APP = annexcheck
# Build loc
BUILDLOC = build
# Install location
INSTLOC = $(GOPATH)/bin
# Build flags
VERNUM = $(shell cut -d= -f2 version)
ncommits = $(shell git rev-list --count HEAD)
BUILDNUM = $(shell printf '%06d' $(ncommits))
COMMITHASH = $(shell git rev-parse HEAD)
LDFLAGS = -ldflags="-X main.appversion=$(VERNUM) -X main.build=$(BUILDNUM) -X main.commit=$(COMMITHASH)"
SOURCES = $(shell find . -type f -iname "*.go") version
.PHONY: $(APP) install clean uninstall
$(APP): $(BUILDLOC)/$(APP)
install: $(APP)
install $(BUILDLOC)/$(APP) $(INSTLOC)/$(APP)
clean:
rm -r $(BUILDLOC)
uninstall:
rm $(INSTLOC)/$(APP)
$(BUILDLOC)/$(APP): $(SOURCES)
go build $(LDFLAGS) -o $(BUILDLOC)/$(APP) ./cmd/annexcheck