-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
68 lines (56 loc) · 1.46 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
67
68
# Variables
BINARY_NAME=system-stats-backend
GO=go
BUILD_DIR=build
MAIN_FILE=main.go
.PHONY: all build clean run test help dev
# Default target
all: clean build
# Build the application
build:
@echo "Building..."cd
@mkdir -p $(BUILD_DIR)
@$(GO) build -o $(BUILD_DIR)/$(BINARY_NAME) $(MAIN_FILE)
@echo "Build complete! Binary available at: $(BUILD_DIR)/$(BINARY_NAME)"
# Clean build artifacts
clean:
@echo "Cleaning..."
@rm -rf $(BUILD_DIR)
@rm -rf docs/docs.go docs/swagger.json docs/swagger.yaml
@go clean
@echo "Clean complete!"
# Run the application
run:
@$(GO) run $(MAIN_FILE)
# Run tests
test:
@echo "Running tests..."
@$(GO) test -v ./...
# Install dependencies
deps:
@echo "Installing dependencies..."
@$(GO) mod tidy
@$(GO) mod download
@echo "Dependencies installed!"
# Install development tools
dev-deps:
@echo "Installing development dependencies..."
@go install github.com/swaggo/swag/cmd/swag@latest
@echo "Development dependencies installed!"
# Show help
help:
@echo "Available targets:"
@echo " make - Clean and build the application"
@echo " make build - Build the application"
@echo " make clean - Remove build artifacts"
@echo " make run - Run the application"
@echo " make test - Run tests"
@echo " make deps - Install project dependencies"
@echo " make dev-deps - Install development tools"
@echo " make help - Show this help message"
dev:
air
build:
go build -o ./tmp/main .
clean:
rm -rf ./tmp