-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
35 lines (26 loc) · 967 Bytes
/
Makefile
File metadata and controls
35 lines (26 loc) · 967 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
.PHONY: build test fmt lint dist install clean demo
VERSION ?= dev
LDFLAGS := -X main.version=$(VERSION)
build:
go build -ldflags "$(LDFLAGS)" -o treehouse .
test:
go test ./...
fmt:
gofmt -w .
lint:
gofmt -l .
go vet ./...
dist:
@mkdir -p dist
GOOS=darwin GOARCH=arm64 go build -ldflags "$(LDFLAGS)" -o dist/treehouse-darwin-arm64 .
GOOS=darwin GOARCH=amd64 go build -ldflags "$(LDFLAGS)" -o dist/treehouse-darwin-amd64 .
GOOS=linux GOARCH=arm64 go build -ldflags "$(LDFLAGS)" -o dist/treehouse-linux-arm64 .
GOOS=linux GOARCH=amd64 go build -ldflags "$(LDFLAGS)" -o dist/treehouse-linux-amd64 .
GOOS=windows GOARCH=arm64 go build -ldflags "$(LDFLAGS)" -o dist/treehouse-windows-arm64.exe .
GOOS=windows GOARCH=amd64 go build -ldflags "$(LDFLAGS)" -o dist/treehouse-windows-amd64.exe .
install: build
cp treehouse $(GOPATH)/bin/ 2>/dev/null || cp treehouse /usr/local/bin/
demo: build
vhs demo.tape
clean:
rm -rf treehouse dist/ coverage.out