-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
30 lines (22 loc) · 793 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
APP = dedupify
# WORKING_PATH = /go/src/$(APP)
# DOCKER_CMD = docker run --rm -it -e GOCACHE=/tmp --user $$(id -u):$$(id -g) -v $$PWD:$(WORKING_PATH) -v $$GOPATH/pkg:/go/pkg -v $$GOPATH/bin:/go/bin -w $(WORKING_PATH) golang:1.18-buster
WORKING_PATH = .
DOCKER_CMD =
VERSION ?= 0.0.1
$(APP): main.go
$(DOCKER_CMD) go build -ldflags="-X 'main.version=$(VERSION)'" -o $(WORKING_PATH)/$(APP) main.go
build: $(APP)
hash: build
./$(APP) hash
clean:
rm -f $(APP)
fmt:
$(DOCKER_CMD) gofmt -s -w $(WORKING_PATH)
release:
goreleaser build --single-target --rm-dist --snapshot --skip-validate --skip-post-hooks -o $(WORKING_PATH)/$(APP)
watch:
fd -e go | entr make --no-print-directory --always-make
install: build
sudo cp $(APP) /usr/local/bin/$(APP)
sudo chmod +x /usr/local/bin/$(APP)