forked from krzko/otelgen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
66 lines (47 loc) · 1.34 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# Go parameters
GOCMD=go
GOBUILD=$(GOCMD) build
GOCLEAN=$(GOCMD) clean
GOTEST=$(GOCMD) test
GOGET=$(GOCMD) get
GOMOD=$(GOCMD) mod
GOLINT=golangci-lint
# Binary name
BINARY_NAME=otelgen
# Main package path
MAIN_PACKAGE=./cmd/otelgen
# Build directory
BUILD_DIR=./build
# Source files
SRC=$(shell find . -name "*.go")
# Test coverage output
COVERAGE_OUTPUT=coverage.out
.PHONY: all build clean test coverage lint deps tidy run help
all: build
build: ## Build the binary
$(GOBUILD) -o $(BUILD_DIR)/$(BINARY_NAME) $(MAIN_PACKAGE)
clean: ## Remove build artifacts
$(GOCLEAN)
rm -rf $(BUILD_DIR)
rm -f $(COVERAGE_OUTPUT)
test: ## Run tests
$(GOTEST) -v ./...
coverage: ## Run tests with coverage
$(GOTEST) -v -coverprofile=$(COVERAGE_OUTPUT) ./...
$(GOCMD) tool cover -html=$(COVERAGE_OUTPUT)
lint: ## Run linter
$(GOLINT) run
deps: ## Download dependencies
$(GOGET) -v -t -d ./...
tidy: ## Tidy and verify dependencies
$(GOMOD) tidy
$(GOMOD) verify
run: build ## Run the application
$(BUILD_DIR)/$(BINARY_NAME)
docker-build: ## Build Docker image
docker build -t $(BINARY_NAME) .
docker-run: ## Run Docker container
docker run --rm $(BINARY_NAME)
help: ## Display this help screen
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
.DEFAULT_GOAL := help