-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
41 lines (32 loc) · 1.38 KB
/
Makefile
File metadata and controls
41 lines (32 loc) · 1.38 KB
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
BIN="./bin"
BIN_NAME="multipilot"
MAIN_PKG="."
SRC=$(shell find . -name "*.go")
ifeq (, $(shell which golangci-lint))
$(warning "could not find golangci-lint in $(PATH), run: curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh")
endif
.PHONY: fmt lint test install_deps clean
all: fmt lint test build
fmt:
$(info ******************** checking formatting ********************)
@test -z $(shell gofmt -l $(SRC)) || (gofmt -d $(SRC); exit 1)
lint:
$(info ******************** running lint tools ********************)
golangci-lint run -v
test: install_deps
$(info ******************** running tests ********************)
go test -v ./...
install_deps:
$(info ******************** downloading dependencies ********************)
go get -v ./...
build: install_deps
$(info ******************** building project ********************)
@mkdir -p ${BIN}
GOARCH=amd64 GOOS=darwin go build -o ${BIN}/${BIN_NAME}-darwin-amd64 ${MAIN_PKG}
GOARCH=amd64 GOOS=linux go build -o ${BIN}/${BIN_NAME}-linux-amd64 ${MAIN_PKG}
GOARCH=amd64 GOOS=windows go build -o ${BIN}/${BIN_NAME}-windows-amd64.exe ${MAIN_PKG}
GOARCH=arm64 GOOS=darwin go build -o ${BIN}/${BIN_NAME}-darwin-arm64 ${MAIN_PKG}
GOARCH=arm64 GOOS=linux go build -o ${BIN}/${BIN_NAME}-linux-arm64 ${MAIN_PKG}
GOARCH=arm64 GOOS=windows go build -o ${BIN}/${BIN_NAME}-windows-arm64.exe ${MAIN_PKG}
clean:
@rm -rf ${BIN}