build system (first pass)
This commit is contained in:
@@ -92,12 +92,19 @@ print_usage :: proc() {
|
||||
fmt.eprintln(
|
||||
" brolang translate-c|--translate-c <header.h> [--target aarch64-macos] [--c-include-path <dir> | --c-define <name[=value]>]...",
|
||||
)
|
||||
fmt.eprintln(
|
||||
" brolang build [root] (reads root/build.bro; root defaults to the current directory)",
|
||||
)
|
||||
}
|
||||
|
||||
is_translate_c_command :: proc(arg: string) -> bool {
|
||||
return arg == "translate-c" || arg == "--translate-c"
|
||||
}
|
||||
|
||||
is_build_command :: proc(arg: string) -> bool {
|
||||
return arg == "build"
|
||||
}
|
||||
|
||||
zig_lib_dir_from_env_output :: proc(text: string, allocator := context.allocator) -> (string, bool) {
|
||||
rest := text
|
||||
prefix := ".lib_dir = \""
|
||||
@@ -233,6 +240,10 @@ run_translate_c :: proc(args: []string) -> int {
|
||||
}
|
||||
|
||||
main :: proc() {
|
||||
if len(os2.args) >= 2 && is_build_command(os2.args[1]) {
|
||||
root := os2.args[2] if len(os2.args) >= 3 else "."
|
||||
os2.exit(compiler.run_build(root))
|
||||
}
|
||||
if len(os2.args) >= 2 && is_translate_c_command(os2.args[1]) {
|
||||
os2.exit(run_translate_c(os2.args))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user