-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
76 lines (55 loc) · 1.19 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
SHELL := /bin/bash
DESTDIR ?=
PREFIX = /usr/local
BINDIR = $(PREFIX)/bin
INSTALL := install -m 0755
INSTALL_PROGRAM := $(INSTALL)
CHECKSUM_CMD := shasum -a 256
CHECKSUM_FILE := sha256sum.txt
GO := go
GOOS := $(shell $(GO) env GOOS)
GOARCH := $(shell $(GO) env GOARCH)
GOENV := $(shell $(GO) env GOPATH)
GORELEASER := $(GOENV)/bin/goreleaser
SINGLE_TARGET=--single-target
default: all
.PHONY: all
all: clean build
.PHONY: install
install: build
$(INSTALL_PROGRAM) -d $(DESTDIR)$(BINDIR)
$(INSTALL_PROGRAM) pget $(DESTDIR)$(BINDIR)/pget
.PHONY: uninstall
uninstall:
rm -f $(DESTDIR)$(BINDIR)/pget
.PHONY: clean
clean:
$(GO) clean
rm -rf dist
rm -f pget
.PHONY: test-all
test-all: test lint
.PHONY: test
test:
script/test $(ARGS)
.PHONY: lint
lint: CHECKONLY=1
lint: format
script/lint
.PHONY: format
format: CHECKONLY=1
format:
CHECKONLY=$(CHECKONLY) script/format
.PHONY: tidy
tidy:
go mod tidy
.PHONY: install-goreleaser
install-goreleaser:
$(GO) install github.com/goreleaser/goreleaser/v2@latest
.PHONY: build
build: pget
.PHONY: build-all
build-all: SINGLE_TARGET:=
build-all: clean pget
pget: install-goreleaser
$(GORELEASER) build --snapshot --clean $(SINGLE_TARGET) -o ./pget