forked from Layr-Labs/eigenlayer-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
45 lines (32 loc) · 1.54 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
.PHONY: help build tests mocks fmt format-lines lint install build-linux-amd64 build-linux-arm64 build-linux
include .env
GO_LINES_IGNORED_DIRS=
GO_PACKAGES=./pkg/... ./cmd/... ./internal/...
GO_FOLDERS=$(shell echo ${GO_PACKAGES} | sed -e "s/\.\///g" | sed -e "s/\/\.\.\.//g")
help:
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
build: ## Compile the binary
@mkdir -p bin
@go build -o bin/$(APP_NAME) cmd/$(APP_NAME)/main.go
mocks: ## generates mocks
go install go.uber.org/mock/mockgen@v0.4.0
go generate ./...
tests: ## runs all tests
go test ./... -covermode=atomic
fmt: ## formats all go files
go fmt ./...
make format-lines
format-lines: ## formats all go files with golines
go install github.com/segmentio/golines@latest
golines -w -m 120 --ignore-generated --shorten-comments --ignored-dirs=${GO_LINES_IGNORED_DIRS} ${GO_FOLDERS}
lint: ## runs all linters
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
golangci-lint run ./...
install: build ## compile the binary and copy it to PATH
@sudo cp bin/$(APP_NAME) /usr/local/bin
build-linux-amd64: ## Compile the binary for amd64
@env GOOS=linux GOARCH=amd64 go build -o bin/$(APP_NAME)-linux-amd64 cmd/$(APP_NAME)/main.go
build-linux-arm64: ## Compile the binary for arm64
@env GOOS=linux GOARCH=arm64 go build -o bin/$(APP_NAME)-linux-arm64 cmd/$(APP_NAME)/main.go
build-linux: ## Compile the binary for linux
@env GOOS=linux go build -o bin/$(APP_NAME) cmd/$(APP_NAME)/main.go