-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbuild.redb
More file actions
83 lines (67 loc) · 2.07 KB
/
build.redb
File metadata and controls
83 lines (67 loc) · 2.07 KB
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
@includeC("redbuild.h")
@includeC("syscalls/syscalls.h")
bool bootstrap = true;
//FEATURE: @invoke. Allows invoking certain functions from cmd line arguments. In code generation, write code to parse argv and match against function name, then invoke function
bool rulegen {
new_module("rulegen");
set_name("rulegen");
set_target(target_native);
set_package_type(package_bin);
source("ir/manual_gen.c");
source("codegen/codeformat.c");
add_precomp_flag("NOCODETRANSFORM");
add_precomp_flag("RULECODEGEN");
add_precomp_flag("RULETRANSFORM");
source("codegen/identity_transform.c");
source("codegen/codegen.c");
source("ir/general.c");
source("rule_generator/rulecodegen.c");
source("rule_generator/ruleparser.c");
source("rule_generator/rule_transform.c");
if (compile()){
gen_compile_commands("rule_generator/ruleparser.c");
return run() == 0;
}
return 0;
}
bool genc {
if (rulegen()){
if (bootstrap){ return true; }
return quick_cred("semantic/sem_enum.cred","semantic/semantic_rules") &&
quick_cred("codegen/codegen.cred","codegen/codegen") &&
true;
}
return false;
}
compiler {
if (genc()){
new_module("compiler");
set_name("cred");
set_target(target_native);
set_package_type(package_bin);
ignore_source("ruleparser.c");
ignore_source("build.c");
ignore_source("output.c");
add_precomp_flag("CCODEGEN");
add_precomp_flag("CTRANS");
add_precomp_flag("NORULETRANSFORM");
// add_precomp_flag("GRAPHCODEGEN");
debug();
source_all(".c");
if (compile()){
gen_compile_commands(0);
print("Running cred");
run();
}
}
}
int main {
u64 start = get_time();
print("Start at %i",start);
defer emit_compile_commands();
rebuild_self();
compiler();
u64 end = get_time();
print("Compilation finished %lims",end-start);
return 0;
}