-
Notifications
You must be signed in to change notification settings - Fork 7
/
Makefile
53 lines (42 loc) · 1.04 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
# 项目名称
APP_NAME := pdu
# Go 编译器
GO := go
# 构建目录
BUILD_DIR := build
# 源文件目录
SRC_DIR := ./cmd/pdu
# 默认目标
all: build
# 构建目标
build: $(SRC_DIR)/main.go
@echo "Building $(APP_NAME)..."
@mkdir -p $(BUILD_DIR)
@$(GO) build -o $(BUILD_DIR)/$(APP_NAME) $(SRC_DIR)/main.go
# 清理目标
clean:
@echo "Cleaning build directory..."
@rm -rf $(BUILD_DIR)
# 安装依赖
deps:
@echo "Installing dependencies..."
@$(GO) mod tidy
# 运行目标
run: build
@echo "Running $(APP_NAME) with arguments $(ARGS)..."
@./$(BUILD_DIR)/$(APP_NAME) $(ARGS)
# 测试目标
test:
@echo "Running tests..."
@$(GO) test ./...
# 帮助信息
help:
@echo "Usage:"
@echo " make Build the project"
@echo " make build Build the project"
@echo " make clean Clean the build directory"
@echo " make deps Install dependencies"
@echo " make run Build and run the project with arguments"
@echo " make test Run tests"
@echo " make help Show this help message"
.PHONY: all build clean deps run test help