From b02cf96cd03e0d02f2dbf5162b1406ae864d41a0 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Sat, 13 Jan 2018 19:59:05 +0800 Subject: Codegen - Support writing the build command to a file (instead of running it) --- src/trans/codegen_c.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/trans/codegen_c.cpp') diff --git a/src/trans/codegen_c.cpp b/src/trans/codegen_c.cpp index f970d518..6f728d8f 100644 --- a/src/trans/codegen_c.cpp +++ b/src/trans/codegen_c.cpp @@ -581,7 +581,12 @@ namespace { } //DEBUG("- " << cmd_ss.str()); ::std::cout << "Running comamnd - " << cmd_ss.str() << ::std::endl; - if( system(cmd_ss.str().c_str()) != 0 ) + if( opt.build_command_file != "" ) + { + ::std::cerr << "INVOKE CC: " << cmd_ss.str() << ::std::endl; + ::std::ofstream(opt.build_command_file) << cmd_ss.str() << ::std::endl; + } + else if( system(cmd_ss.str().c_str()) != 0 ) { ::std::cerr << "C Compiler failed to execute" << ::std::endl; abort(); -- cgit v1.2.3