feat: 项目初始化
This commit is contained in:
23
Makefile
Normal file
23
Makefile
Normal file
@@ -0,0 +1,23 @@
|
||||
APP_NAME = netctl
|
||||
SRC = .
|
||||
OUTPUT = ./bin/$(APP_NAME).exe
|
||||
GO = go
|
||||
|
||||
# 获取 Git commit
|
||||
GIT_COMMIT := $(shell git rev-parse --short HEAD 2>/dev/null || echo none)
|
||||
# 获取当前时间 UTC
|
||||
BUILD_TIME := $(shell date -u +%Y-%m-%dT%H:%M:%SZ)
|
||||
|
||||
.PHONY: build run clean
|
||||
|
||||
# 编译命令
|
||||
build:
|
||||
$(GO) build -ldflags "-X 'netcli/cmd.Version=1.0.0' -X 'netcli/cmd.Commit=$(GIT_COMMIT)' -X 'netcli/cmd.BuildTime=$(BUILD_TIME)'" -o $(OUTPUT) $(SRC)
|
||||
|
||||
# 直接运行
|
||||
run:
|
||||
$(GO) run -ldflags "-X 'netcli/cmd.Version=1.0.0' -X 'netcli/cmd.Commit=$(GIT_COMMIT)' -X 'netcli/cmd.BuildTime=$(BUILD_TIME)'" $(SRC)
|
||||
|
||||
# 清理编译文件
|
||||
clean:
|
||||
rm -f $(OUTPUT)
|
||||
Reference in New Issue
Block a user