feat(build): 引入新的 Python 构建系统并移除旧 Makefile
新增基于 Python 的构建脚本 `cbuild.py`,支持包管理、依赖解析和模块化编译。 同时添加 `.gitignore` 忽略 `build` 目录,并在 `justfile` 中更新构建命令。 移除了原有的 `lib/Makefile` 和主目录下的相关 make 规则,统一使用新构建系统。
This commit is contained in:
2
tests/cbuild/cbuild.toml
Normal file
2
tests/cbuild/cbuild.toml
Normal file
@@ -0,0 +1,2 @@
|
||||
[package]
|
||||
name = "test_cbuild"
|
||||
6
tests/cbuild/include/add.h
Normal file
6
tests/cbuild/include/add.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#ifndef __ADD_H__
|
||||
#define __ADD_H__
|
||||
|
||||
int add(int a, int b);
|
||||
|
||||
#endif
|
||||
3
tests/cbuild/src/add.c
Normal file
3
tests/cbuild/src/add.c
Normal file
@@ -0,0 +1,3 @@
|
||||
int add(int a, int b) {
|
||||
return a + b;
|
||||
}
|
||||
8
tests/cbuild/src/main.c
Normal file
8
tests/cbuild/src/main.c
Normal file
@@ -0,0 +1,8 @@
|
||||
#include <stdio.h>
|
||||
#include <add.h>
|
||||
|
||||
int main() {
|
||||
printf("Hello World!\n");
|
||||
printf("Add 1 + 1 = %d\n", add(1, 1));
|
||||
return 0;
|
||||
}
|
||||
10
tests/cbuild/tests/test_main.c
Normal file
10
tests/cbuild/tests/test_main.c
Normal file
@@ -0,0 +1,10 @@
|
||||
int add(int a, int b);
|
||||
#include <assert.h>
|
||||
|
||||
int main() {
|
||||
int a = 1;
|
||||
int b = 2;
|
||||
int c = add(a, b);
|
||||
assert(c == 3);
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user