forked from huydx/hget
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
30 lines (23 loc) · 677 Bytes
/
Makefile
File metadata and controls
30 lines (23 loc) · 677 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
COMMIT := $(shell git describe --always)
BINARY := hget
BINDIR := bin
INSTALL_PATH := /usr/local/bin
.PHONY: all clean build install test deps
all: build
deps:
@echo "====> Updating dependencies..."
go mod tidy
clean:
@echo "====> Removing installed binary"
rm -f $(BINDIR)/$(BINARY)
test:
@echo "====> Running tests..."
go test -v ./...
build: deps
@echo "====> Building $(BINARY) in ./$(BINDIR)"
mkdir -p $(BINDIR)
go build -ldflags "-X main.GitCommit=\"$(COMMIT)\"" -o $(BINDIR)/$(BINARY)
install: build
@echo "====> Installing $(BINARY) in $(INSTALL_PATH)/$(BINARY)"
chmod +x ./$(BINDIR)/$(BINARY)
sudo mv ./$(BINDIR)/$(BINARY) $(INSTALL_PATH)/$(BINARY)