-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathMakefile
More file actions
42 lines (35 loc) · 994 Bytes
/
Makefile
File metadata and controls
42 lines (35 loc) · 994 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
42
GOLANGCI := $(GOPATH)/bin/golangci-lint
APP_NAME := analyzer
BUILD_DIR := bin
PLATFORMS := \
linux/amd64 \
linux/arm64 \
darwin/amd64 \
darwin/arm64 \
windows/amd64
BINARIES := $(foreach platform,$(PLATFORMS),$(BUILD_DIR)/$(APP_NAME)-$(subst /,-,$(platform)))
.PHONY: analyzer
analyzer:
go build -o ./bin/analyzer ./main.go
.PHONY: build-all
build-all: $(BINARIES)
$(BUILD_DIR)/$(APP_NAME)-%:
@mkdir -p $(BUILD_DIR)
@GOOS=$(word 1,$(subst -, ,$*)) GOARCH=$(word 2,$(subst -, ,$*)) go build -o $@ ./main.go
@echo "Built $@"
.PHONY: get
get:
go mod download && go mod tidy
.PHONY: get_lint
get_lint:
@if [ ! -f ./bin/golangci-lint ]; then \
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.63.0; \
fi;
.PHONY: lint
lint: get_lint
@echo " > \033[32mRunning lint...\033[0m "
./bin/golangci-lint run --config=./.golangci.yml --fix
.PHONY: test
test:
@echo " > \033[32mRunning sprinter-api tests...\033[0m "
go test -v ./...