diff --git a/riscv_rules.hancho b/riscv_rules.hancho index 8443d65..a4de10a 100644 --- a/riscv_rules.hancho +++ b/riscv_rules.hancho @@ -10,11 +10,14 @@ rv_config = hancho.Config( "-MMD" ], rv_opt_mode = "-O0", + joined_warnings = "{join_prefix('-W', get('warnings', []))}", + joined_defines = "{join_prefix('-D', get('defines', []))}", + joined_includes = "{join_prefix('-I', get('includes', []))}", ) rv_compile = hancho.Command( rv_config, - command = "{rv_toolchain}-g++ {rv_flags_c} -c {in_src} -o {out_obj}", + command = "{rv_toolchain}-g++ {rv_flags_c} {joined_warnings} {joined_defines} {joined_includes} -c {in_src} -o {out_obj}", out_obj = "{swap_ext(in_src, '.o')}", c_deps = "{swap_ext(in_src, '.d')}", ) @@ -22,8 +25,7 @@ rv_compile = hancho.Command( rv_link = hancho.Command( rv_config, command = "{rv_toolchain}-gcc {rv_flags_c} {in_objs} -o {out_bin} -lgcc", - rv_flags_c = [ - rv_config.rv_flags_c, + rv_flags_c = rv_config.rv_flags_c + [ "-nostdlib", "-nostartfiles", "-Wl,-T {linkerscript}",