-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
85 lines (71 loc) · 2.73 KB
/
Copy pathMakefile
File metadata and controls
85 lines (71 loc) · 2.73 KB
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# linkcode Makefile
# 企微 Bot 桥接 Claude Code 的子进程管理系统
#
# 用法:
# make run 编译 + 前台启动(可 Ctrl+C 停止)
# make run -daemon 编译 + 后台启动
# make restart 前台重启(不编译)
# make restart -daemon 后台重启(不编译)
# make build 仅编译
# make stop 停止
# make status 查看状态
# make clean 清理编译产物
#
# 脚本逻辑在 make.ps1 中,支持 PowerShell Core (pwsh) 和 Windows PowerShell。
# 强制使用 Git Bash 的 sh,避免 Windows 下 make 默认用 cmd.exe
SHELL := D:/apps/git/Git/bin/sh.exe
.SHELLFLAGS := -c
# 自动检测 pwsh / powershell
# 用裸名(pwsh/powershell),让 GnuWin32 make 的 CreateProcess 走 Windows PATH 解析;
# 不能用 command -v 的输出——那会返回 MSYS 路径 /c/Windows/...,原生 make 直执行时找不到。
PW := $(shell if command -v pwsh >/dev/null 2>&1; then echo pwsh; else echo powershell; fi)
.PHONY: build run restart stop status clean
build:
$(PW) -File make.ps1 build
run:
$(PW) -File make.ps1 run
restart:
$(PW) -File make.ps1 restart
daemon:
$(PW) -File make.ps1 restart -daemon
@echo ""
@echo "后台运行中。查看日志:"
@echo " tail -f \$$TEMP/linkcode.log"
@echo " make status"
run-daemon:
$(PW) -File make.ps1 run -daemon
@echo ""
@echo "后台运行中。查看日志:"
@echo " tail -f \$$TEMP/linkcode.log"
@echo " make status"
restart-daemon:
$(PW) -File make.ps1 restart -daemon
@echo ""
@echo "后台运行中。查看日志:"
@echo " tail -f \$$TEMP/linkcode.log"
@echo " make status"
# 短别名:make restart-d / make run-d(等价于 -daemon 版本)。
# 注意:不能用 "make restart -d"——-d 是 make 内置 debug 开关,会被 make 吞掉且不透传。
restart-d: restart-daemon
run-d: run-daemon
stop:
$(PW) -File make.ps1 stop
status:
$(PW) -File make.ps1 status
clean:
$(PW) -File make.ps1 clean
help:
@echo "linkcode make targets:"
@echo " make run 编译 + 前台启动"
@echo " make run -daemon 编译 + 后台启动"
@echo " make run-daemon 编译 + 后台启动(快捷方式)"
@echo " make restart 前台重启,不编译"
@echo " make restart -daemon 后台重启,不编译"
@echo " make restart-daemon 后台重启,不编译(快捷方式)"
@echo " make restart-d 后台重启,不编译(-d 短别名)"
@echo " make run-d 编译 + 后台启动(-d 短别名)"
@echo " make daemon 后台重启,不编译"
@echo " make build 仅编译"
@echo " make stop 停止"
@echo " make status 查看状态"
@echo " make clean 清理编译产物"