-
Notifications
You must be signed in to change notification settings - Fork 0
/
nobuild.c
59 lines (53 loc) · 1.37 KB
/
nobuild.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#define NOBUILD_IMPLEMENTATION
#include "nobuild.h"
#define C_FLAGS "-Wall", "-Wextra", "-pedantic", "-std=c11"
void build_linked_list_so() {
INFO("Building Linked List SO");
MKDIRS("build", "lib");
CMD("cc", C_FLAGS, "-shared", "-fPIC",
PATH("src", "lib", "linked_list.c"),
"-I./src/lib",
"-o",
PATH("build", "lib", "libll.so"));
}
void build_eval_utils() {
INFO("Building eval_utils");
MKDIRS("build", "out");
CMD("cc", C_FLAGS, "-c",
PATH("src", "eval_utils.c"),
"-I./src/",
"-I./src/lib",
"-o",
PATH("build", "out", "eval_utils.o"));
}
void build_eval() {
INFO("Building eval");
MKDIRS("build", "out");
CMD("cc", C_FLAGS, "-c",
PATH("src", "eval.c"),
"-I./src",
"-I./src/lib",
"-o",
PATH("build", "out", "eval.o"));
}
void build_main() {
INFO("Building c_eval");
MKDIRS("build", "bin");
CMD("cc", C_FLAGS, "-o", PATH("build", "bin", "c_eval"),
"-L./build/lib/",
"-I./src",
"-I./src/lib",
PATH("src", "main.c"),
PATH("build", "out", "eval_utils.o"),
PATH("build", "out", "eval.o"),
"-lll",
"-lm");
}
int main(int argc, char **argv) {
GO_REBUILD_URSELF(argc, argv);
build_linked_list_so();
build_eval_utils();
build_eval();
build_main();
return 0;
}