Skip to content

Instantly share code, notes, and snippets.

@petabyt
Created November 18, 2022 21:49
Show Gist options
  • Save petabyt/174e5432dd0ef7f4cd122857a68170fb to your computer and use it in GitHub Desktop.
Save petabyt/174e5432dd0ef7f4cd122857a68170fb to your computer and use it in GitHub Desktop.
next generation build system
#include <build.h>
int my_clean() {
return build_shell(build_rm, "-rf", "*.o");
}
int my_out(char *in, char *out) {
return build_shell(build_cc, in, "-o", out);
}
int build() {
build_add_phony("clean", my_clean);
Target t = build_target("example.o");
t.add_dep("main.o");
Rule r = build_rule("*.o", "*.c", my_out);
build_set_default("example.o");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment