forked from emprcl/runal
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
39 lines (32 loc) · 1.17 KB
/
Makefile
File metadata and controls
39 lines (32 loc) · 1.17 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
BIN := bin
BIN_NAME := runal
CLI_DIR := cli
CLI_ENTRYPOINT := .
GOLANG_BIN := go
CGO_ENABLED := 0
GOLANG_OS := linux
GOLANG_ARCH := amd64
GOLANG_BUILD_OPTS += GOOS=$(GOLANG_OS)
GOLANG_BUILD_OPTS += GOARCH=$(GOLANG_ARCH)
GOLANG_BUILD_OPTS += CGO_ENABLED=$(CGO_ENABLED)
GOLANG_LINT := $(BIN)/golangci-lint
GOLANG_LDFFLAGS := -ldflags="-w -s"
$(BIN):
mkdir -p $(BIN)
$(GOLANG_LINT): $(BIN)
GOBIN=$$(pwd)/$(BIN) go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest
build: $(BIN)
$(GOLANG_BUILD_OPTS) $(GOLANG_BIN) build -C $(CLI_DIR) $(GOLANG_LDFFLAGS) -o ../$(BIN)/$(BIN_NAME) $(CLI_ENTRYPOINT)
chmod +x $(BIN)/$(BIN_NAME)
checks: $(GOLANG_LINT)
$(GOLANG_LINT) run ./...
test:
$(GOLANG_BIN) test ./...
bench:
$(GOLANG_BIN) test -bench=. -benchmem ./...
deps:
@find . -type d \( -name build -prune \) -o -name go.mod -print | while read -r gomod_path; do \
dir_path=$$(dirname "$$gomod_path"); \
echo "Executing 'go mod tidy' in directory: $$dir_path"; \
(cd "$$dir_path" && go get -u ./... && go mod tidy) || exit 1; \
done