TomasBorquez/mate.h
关于
用 C 编写的 C 构建系统。
开发工具实测星标增长
- 24小时
- 0
- 7天
- 0
- 15天
- +5
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文Mate
About
Mate is a build system for C in C, and all you need to run it is a C compiler. If you want to learn more about it, check out our examples, which should teach you everything you need to know to use it.
Here is a simple example of a mate.c:
#define MATE_IMPLEMENTATION // Adds function implementations
#include "mate.h"
int main() {
StartBuild();
{
Executable executable = CreateExecutable((ExecutableOptions){
.output = "main", // output name, in windows this becomes `main.exe` automatically
.flags = "-Wall -g" // adds warnings and debug symbols
});
// Files to compile
AddFile(executable, "./src/main.c");
// Compiles all files parallely with samurai
InstallExecutable(executable);
// Runs the main executable
RunCommand(executable.outputPath);
}
EndBuild();
}
To use it all you need is mate.h file on the same folder you have the mate.c example file and you can run by gcc ./mate.c -o ./mate && ./mate, after running once
it will auto detect if you need to rebuild based on mate-cache.ini, so you can just run ./mate directly and it'll rebuild itself.
Under the hood we use Samurai, which is a ninja rewrite in C. We boostrapped it to mate.h, which compiles it on the first run. After that it is cached;
thanks to this, builds are extremely fast (the first build usually takes a bit longer, but the second one should be very fast). If you want even faster builds, you can use TCC,
which is a tinier and faster C compiler. On medium sized projects, our builds go from 600ms to 20ms because tcc was made to be very fast to compile.
Operating Systems
| OS | Status | Notes |
|---|---|---|
| Linux | Supported | Uses Samurai under the hood |
| Windows | Supported | Requires Ninja build system (Samurai in progress) |
| MacOS | Supported | Must use Frameworks for libraries |
| FreeBSD | Supported | TCC is not stable on FreeBSD, use GCC or Clang(LLVM) |
Compilers
| Compiler | Status | Notes |
|---|---|---|
| GCC | Supported | Primary development target with best support |
| Clang | Supported | Works perfectly well too |
| TinyC | Supported | Recommended if you want fast compile times |
| MSVC | Somewhat Supported | Works normally except for libraries, MinGW is recommended instead |
Contributing
You wanna help out contributing? Great, read our contribution guidelines for information about the project and look into our TODOS or our issues to see what you would like to contribute on, documentation contributions are also welcomed :)
Acknowledgments
This project incorporates code from Samurai, which is primarily licensed under ISC license by Michael Forney, with portions under Apache License 2.0 and MIT licenses. The full license text is available in the LICENSE-SAMURAI.txt file.
Inspired from build.zig, nob.h, CMake and Meson build systems, aswell as other unrelated C libraries like raylib and clay.h in terms of interfaces and implementations.
探索相关项目
加载中…
