-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
46 lines (39 loc) · 999 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
45
46
GO = GO111MODULE=on GOFLAGS=-mod=vendor go
VERSION = 0.1.0
BINARY = super-hacker
BINDIR = bin
LDFLAGS = -ldflags "-X main.gitSHA=$(shell git rev-parse HEAD) -X main.version=$(VERSION) -X main.name=$(BINARY)"
OS = $(shell uname)
$(BINDIR)/$(BINARY): $(BINDIR)
$(GO) build -v -o $(BINDIR)/$(BINARY) $(LDFLAGS)
$(BINDIR):
mkdir $(BINDIR)
install: clean
ifeq ($(OS),Darwin)
./build.sh darwin $(VERSION)
cp -f $(BINDIR)/$(BINARY)-darwin /usr/local/$(BINDIR)/$(BINARY)
endif
ifeq ($(OS),Linux)
./build.sh linux $(VERSION)
cp -f $(BINDIR)/$(BINARY)-linux /usr/local/$(BINDIR)/$(BINARY)
endif
ifeq ($(OS),FreeBSD)
./build.sh freebsd $(VERSION)
cp -f $(BINDIR)/$(BINARY)-freebsd /usr/local/$(BINDIR)/$(BINARY)
endif
uninstall:
rm -f /usr/local/$(BINDIR)/$(BINARY)
.PHONY: deps
deps:
$(GO) mod download
$(GO) mod vendor
.PHONY: test
test:
$(GO) test -v -cover ./...
.PHONY: release
release:
./build.sh release $(VERSION)
.PHONY: clean
clean:
$(GO) clean
rm -f $(BINDIR)/*