Ninja安装:
sudo apt install ninja-build
C语言代码:
#include <stdio.h>
int main()
{
printf("hello ninja.\n");
return 0;
}
“build.ninja”:
rule cc command = gcc $in -o $out #rule clean # command = rm $out # If left unspecified, builds get the outer $cflags. build main: cc main.c
编译:
sudo ninja
sudo ./main
结果: