-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
46 lines (35 loc) · 859 Bytes
/
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
46
# Binary name
BINARY=operwrt-version
# Build directory
BUILD_DIR=bin
# Go files
GO_FILES=$(shell find . -name "*.go")
# Linter
LINTER=golangci-lint
# Build the binary
build: $(BUILD_DIR)/$(BINARY)
$(BUILD_DIR)/$(BINARY): $(GO_FILES)
CGO_ENABLED=0 go build -o $@
# Run the linter
lint:
$(LINTER) run
# Clean the build directory
clean:
rm -rf $(BUILD_DIR)
# Run tests
test:
go test ./...
# Run tests with coverage
test-cover:
go test -coverprofile=coverage.out ./...
go tool cover -html=coverage.out
# Help target
help:
@echo "Targets:"
@echo " build Build the binary"
@echo " lint Run the linter"
@echo " clean Clean the build directory"
@echo " test Run tests"
@echo " test-cover Run tests with coverage"
@echo " help Display this help message"
.PHONY: build lint clean test test-cover help