@@ -283,6 +283,7 @@ fn build_target_config() -> @session::config {
283
283
fn build_session_options( str binary , getopts:: match match, str binary_dir ) ->
284
284
@session:: options {
285
285
auto library = opt_present ( match , "lib" ) ;
286
+ auto static = opt_present ( match , "static" ) ;
286
287
auto library_search_paths = [ binary_dir + "/lib" ] ;
287
288
library_search_paths += getopts:: opt_strs ( match , "L" ) ;
288
289
auto output_type =
@@ -332,6 +333,7 @@ fn build_session_options(str binary, getopts::match match, str binary_dir) ->
332
333
auto test = opt_present ( match , "test" ) ;
333
334
let @session:: options sopts =
334
335
@rec ( library=library,
336
+ static =static ,
335
337
optimize=opt_level,
336
338
debuginfo=debuginfo,
337
339
verify=verify,
@@ -455,13 +457,10 @@ fn main(vec[str] args) {
455
457
456
458
saved_out_filename = ofile;
457
459
auto temp_filename;
458
- alt ( sopts. output_type ) {
459
- case ( link:: output_type_exe) {
460
- // FIXME: what about --lib?
461
-
462
- temp_filename = ofile + ".o" ;
463
- }
464
- case ( _) { temp_filename = ofile; }
460
+ if ( sopts. output_type == link:: output_type_exe && !sopts. static ) {
461
+ temp_filename = ofile + ".o" ;
462
+ } else {
463
+ temp_filename = ofile;
465
464
}
466
465
compile_input ( sess, cfg, ifile, temp_filename) ;
467
466
}
@@ -471,7 +470,7 @@ fn main(vec[str] args) {
471
470
// gcc to link the object file with some libs
472
471
//
473
472
// TODO: Factor this out of main.
474
- if ( sopts. output_type != link:: output_type_exe) {
473
+ if ( sopts. output_type != link:: output_type_exe || sopts . static ) {
475
474
ret;
476
475
}
477
476
0 commit comments