-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
41 lines (29 loc) · 775 Bytes
/
Makefile
File metadata and controls
41 lines (29 loc) · 775 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
31
32
33
34
35
36
37
38
39
40
41
# https://www.gnu.org/prep/standards/html_node/Directory-Variables.html#Directory-Variables
PREFIX ?= /usr/local
BINPREFIX ?= $(PREFIX)/bin
DISTDIR := dist
TARGET := mrs
PLATFORMS := darwin freebsd linux
.PHONY: $(PLATFORMS) $(TARGET) all build clean fmt install release test uninstall lint
all: $(TARGET)
build: $(TARGET)
fmt:
go fmt ./...
lint:
golangci-lint run
$(PLATFORMS):
GOARCH=amd64 GOOS=$@ go build -o "$(DISTDIR)/$(TARGET)-$@-amd64"
$(TARGET):
go build -o $@
clean:
go clean
rm -f "$(DISTDIR)/$(TARGET)*"
rm -f coverage.txt
install: $(TARGET)
sudo mkdir -p "$(DESTDIR)$(BINPREFIX)"
sudo cp -pf $(TARGET) "$(DESTDIR)$(BINPREFIX)/"
release: clean $(PLATFORMS)
test:
go test -v ./...
uninstall:
rm -f "$(DESTDIR)$(BINPREFIX)/$(TARGET)"