-
Notifications
You must be signed in to change notification settings - Fork 11
/
Makefile
60 lines (44 loc) · 1.15 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
SHELL := /bin/bash
DESTDIR ?=
PREFIX = /usr/local
BINDIR = $(PREFIX)/bin
INSTALL := install -m 0755
INSTALL_PROGRAM := $(INSTALL)
GO := go
GOOS := $(shell $(GO) env GOOS)
GOARCH := $(shell $(GO) env GOARCH)
VHS := vhs
default: all
.PHONY: all
all: replicate
replicate:
CGO_ENABLED=0 $(GO) build -o $@ \
-ldflags "-X github.com/replicate/cli/internal.version=$(REPLICATE_CLI_VERSION) -w" \
main.go
demo.gif: replicate demo.tape
PATH=$(PWD):$(PATH) $(VHS) demo.tape
.PHONY: install
install: replicate
$(INSTALL_PROGRAM) -d $(DESTDIR)$(BINDIR)
$(INSTALL_PROGRAM) replicate $(DESTDIR)$(BINDIR)/replicate
.PHONY: uninstall
uninstall:
rm -f $(DESTDIR)$(BINDIR)/replicate
.PHONY: clean
clean:
$(GO) clean
rm -f replicate
.PHONY: test
test:
$(GO) test -v ./...
.PHONY: format
format:
$(GO) run golang.org/x/tools/cmd/goimports@latest -d -w -local $(shell $(GO) list -m) .
.PHONY: lint
lint: lint-golangci lint-nilaway
.PHONY: lint-golangci
lint-golangci:
$(GO) run github.com/golangci/golangci-lint/cmd/[email protected] run ./...
.PHONY: lint-nilaway
lint-nilaway:
$(GO) run go.uber.org/nilaway/cmd/[email protected] ./...