diff options
author | John Hodge <tpg@ucc.asn.au> | 2018-01-13 19:59:05 +0800 |
---|---|---|
committer | John Hodge <tpg@ucc.asn.au> | 2018-01-13 21:40:12 +0800 |
commit | b02cf96cd03e0d02f2dbf5162b1406ae864d41a0 (patch) | |
tree | 21c401cc68f4bc24c9021d9675e4614b311717b5 /src/trans/codegen_c.cpp | |
parent | 265af300456d5e4425347123942a67fe1e25f345 (diff) | |
download | mrust-b02cf96cd03e0d02f2dbf5162b1406ae864d41a0.tar.gz |
Codegen - Support writing the build command to a file (instead of running it)
Diffstat (limited to 'src/trans/codegen_c.cpp')
-rw-r--r-- | src/trans/codegen_c.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
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(); |