Files
dynamics/engines/c/Makefile
T
admin e371fa8db1 refactor: 移除旧子进程模式的 main.* 源文件,Makefile 只编译 DLL
- 删除 engines/c/main.c, engines/cpp/main.cpp, engines/fortran/main.f90
- Makefile 移除 all/exe 构建目标,默认只编译 DLL
2026-06-21 05:33:52 +08:00

42 lines
1004 B
Makefile
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# engines/c/Makefile
# 编译 DLL(主程序通过 ctypes 直接调用)
# make dll → 本地系统编译
# make linux → Linux 交叉编译(需 x86_64-linux-gnu-gcc
# make windows → Windows 交叉编译(需 x86_64-w64-mingw32-gcc
CC = gcc
CFLAGS = -O3 -march=native -Wall -Wextra
LDFLAGS = -lm
LIB_SRC = dynamics_lib.c
# 自动检测系统
UNAME_S := $(shell uname -s 2>/dev/null || echo Windows)
# DLL 目标(平台自动选择后缀)
ifeq ($(UNAME_S),Linux)
DLL_TARGET = build/dynamics_c.so
DLL_FLAGS = -shared -fPIC
else ifeq ($(UNAME_S),Darwin)
DLL_TARGET = build/dynamics_c.dylib
DLL_FLAGS = -dynamiclib
else
DLL_TARGET = build/dynamics_c.dll
DLL_FLAGS = -shared
endif
.PHONY: all dll clean
all: dll
dll: $(DLL_TARGET)
$(DLL_TARGET): $(LIB_SRC) | build
$(CC) $(CFLAGS) $(DLL_FLAGS) -o $@ $(LIB_SRC) $(LDFLAGS)
@echo " === C DLL built: $@ ==="
build:
mkdir -p build
clean:
rm -rf build *.o