summaryrefslogtreecommitdiff
path: root/third_party/mcpc/mk/dbgrel.mk
diff options
context:
space:
mode:
authortanaka takashi <isazaka@gmail.com>2026-06-30 19:03:25 +0900
committertanaka takashi <isazaka@gmail.com>2026-06-30 19:03:25 +0900
commit05c8e0a31a0d4192c590e833b24393208e1c751f (patch)
treef7c2c82c9327abde67bf3acf1d0258573b3bc6c2 /third_party/mcpc/mk/dbgrel.mk
parent4bc721c3bf7589b519c5730d093f704ce56e3f09 (diff)
fix: MCPCをvendored fork化しMCP準拠と接続安定性を改善
- Git submoduleを廃止してMCPCを直接管理 - Windowsで254リクエスト付近に発生する切断を修正 - JSON-RPC 2.0エラー応答を標準化 - tool schemaとruntimeの必須・任意引数を一致 - 1000回連続呼び出しの回帰テストを追加
Diffstat (limited to 'third_party/mcpc/mk/dbgrel.mk')
-rw-r--r--third_party/mcpc/mk/dbgrel.mk92
1 files changed, 92 insertions, 0 deletions
diff --git a/third_party/mcpc/mk/dbgrel.mk b/third_party/mcpc/mk/dbgrel.mk
new file mode 100644
index 0000000..a32e0bd
--- /dev/null
+++ b/third_party/mcpc/mk/dbgrel.mk
@@ -0,0 +1,92 @@
+
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
+# dbgrel
+
+ifdef DBG
+ ifeq (1,2)
+ else ifneq (,$(is_gcclike))
+ CFLAGS += -g -O0
+ CFLAGS += -Wall -Wextra -Werror -Wno-unused-function -Wno-unused-parameter -Wno-unused-label
+ CFLAGS += -DMCPC_DBG
+ CFLAGS += -I..
+ else ifneq (,$(is_cllike))
+ CFLAGS += /Zi /Od /Ob0
+ CFLAGS += /RTC1
+ # CFLAGS += /Wall
+ CFLAGS += /DMCPC_DBG
+ CFLAGS += /I..
+ endif
+else
+ ifeq (1,2)
+ else ifneq (,$(is_gcclike))
+ CFLAGS += -Wall -Wextra -Werror -Wno-unused-function -Wno-unused-parameter -Wno-unused-label -Wno-error=unused-variable -Wno-error=unused-but-set-variable
+ CFLAGS += -O2 -Os
+ CFLAGS += -I..
+ else ifneq (,$(is_cllike))
+ CFLAGS += /MD
+ CFLAGS += /Wall
+ CFLAGS += /wd4152 # okay with: nonstandard extension, function/data pointer conversion in expression
+ CFLAGS += /wd4310 # okay with cast causing truncate
+ CFLAGS += /wd4127 # window is wrong about sizeof(long) being constant
+ CFLAGS += /wd4102 # okay to have unref label
+ CFLAGS += /wd4189 # local variable is initialized but not referenced
+ CFLAGS += /wd4100 # its okay not ref to param
+ CFLAGS += /wd5045 # why call spectre rather than boundcheck?
+ CFLAGS += /wd4005 # alloca macro redef is ok
+ CFLAGS += /wd4996 # use strerror sprintf anyway
+ CFLAGS += /wd4456 # no need to warn shadow decl
+ CFLAGS += /wd4255 # ok for C23
+ CFLAGS += /wd4668 # disb #if macro
+ CFLAGS += /wd4710 # disable inline warn
+ CFLAGS += /wd4820 # we know there is padding
+ CFLAGS += /O2 /Ob1
+ CFLAGS += /I..
+ endif
+endif
+
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
+# strip
+
+ifndef DBG
+ # LDFLAGS += --strip-all ld not recoginizing?
+ ifneq (,$(is_linux))
+ LDFLAGS += -s
+ endif
+ ifneq (,$(is_macos))
+ LDFLAGS += -dead_strip
+ endif
+endif
+
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
+# sanitizer
+
+ifdef VALG
+ which_valg = $(shell which valgrind)
+ ifneq (,$(which_valg))
+ is_valg = xxx
+ endif
+endif
+
+
+# NOTE asan triggered only if ASAN=1, we use valgrind by default
+ifdef ASAN
+ is_asan = xxx
+ is_valg =
+ ifneq (,$(is_linux))
+ CFLAGS += -fsanitize=address
+ LDFLAGS += -lasan
+ endif
+ ifneq (,$(is_macos))
+ CFLAGS += -fsanitize=address
+ LDFLAGS += -fsanitize=address
+ endif
+ ifneq (,$(is_cllike))
+ CFLAGS += /fsanitize=address
+ LDFLAGS += /DEBUG
+# LDFLAGS += "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\Llvm\\lib\\clang\\19\\lib\\windows\\clang_rt.asan-i386.lib"
+ LDFLAGS += /NODEFAULTLIB:libcmt.lib
+ LDFLAGS += msvcrt.lib
+ endif
+endif
+
+