| ... | ... | @@ -372,6 +372,13 @@ const SOName = union(enum) { |
| 372 | 372 | yes: []const u8, |
| 373 | 373 | }; |
| 374 | 374 | |
| 375 | const EmitBin = union(enum) { |
| 376 | no, |
| 377 | yes_default_path, |
| 378 | yes: []const u8, |
| 379 | yes_a_out, |
| 380 | }; |
| 381 | |
| 375 | 382 | const Emit = union(enum) { |
| 376 | 383 | no, |
| 377 | 384 | yes_default_path, |
| ... | ... | @@ -471,7 +478,7 @@ fn buildOutputType( |
| 471 | 478 | var time_report = false; |
| 472 | 479 | var stack_report = false; |
| 473 | 480 | var show_builtin = false; |
| 474 | | var emit_bin: Emit = .yes_default_path; |
| 481 | var emit_bin: EmitBin = .yes_default_path; |
| 475 | 482 | var emit_asm: Emit = .no; |
| 476 | 483 | var emit_llvm_ir: Emit = .no; |
| 477 | 484 | var emit_zir: Emit = .no; |
| ... | ... | @@ -1284,7 +1291,7 @@ fn buildOutputType( |
| 1284 | 1291 | switch (c_out_mode) { |
| 1285 | 1292 | .link => { |
| 1286 | 1293 | output_mode = if (is_shared_lib) .Lib else .Exe; |
| 1287 | | emit_bin = .{ .yes = out_path orelse "a.out" }; |
| 1294 | emit_bin = if (out_path) |p| .{ .yes = p } else EmitBin.yes_a_out; |
| 1288 | 1295 | enable_cache = true; |
| 1289 | 1296 | }, |
| 1290 | 1297 | .object => { |
| ... | ... | @@ -1498,6 +1505,11 @@ fn buildOutputType( |
| 1498 | 1505 | }, |
| 1499 | 1506 | }; |
| 1500 | 1507 | |
| 1508 | const a_out_basename = switch (object_format) { |
| 1509 | .pe, .coff => "a.exe", |
| 1510 | else => "a.out", |
| 1511 | }; |
| 1512 | |
| 1501 | 1513 | const emit_bin_loc: ?Compilation.EmitLoc = switch (emit_bin) { |
| 1502 | 1514 | .no => null, |
| 1503 | 1515 | .yes_default_path => Compilation.EmitLoc{ |
| ... | ... | @@ -1549,6 +1561,10 @@ fn buildOutputType( |
| 1549 | 1561 | }; |
| 1550 | 1562 | } |
| 1551 | 1563 | }, |
| 1564 | .yes_a_out => Compilation.EmitLoc{ |
| 1565 | .directory = null, |
| 1566 | .basename = a_out_basename, |
| 1567 | }, |
| 1552 | 1568 | }; |
| 1553 | 1569 | |
| 1554 | 1570 | const default_h_basename = try std.fmt.allocPrint(arena, "{}.h", .{root_name}); |
| ... | ... | @@ -1784,6 +1800,7 @@ fn buildOutputType( |
| 1784 | 1800 | .print = comp.bin_file.options.emit.?.directory.path orelse ".", |
| 1785 | 1801 | }, |
| 1786 | 1802 | .yes => |full_path| break :blk .{ .update = full_path }, |
| 1803 | .yes_a_out => break :blk .{ .update = a_out_basename }, |
| 1787 | 1804 | } |
| 1788 | 1805 | }; |
| 1789 | 1806 | |