sylveos

Toy Operating System
Log | Files | Refs

commit c80b2f6fe21d52e11336b80d92ddfd336758bd37
parent 028d6c9bb01216cb0faefbe9a5f0bff256b72cf1
Author: Sylvia Ivory <git@sivory.net>
Date:   Tue, 20 Jan 2026 17:29:06 -0800

Fix build.zig

Diffstat:
Mbuild.zig | 24++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/build.zig b/build.zig @@ -93,6 +93,17 @@ fn add_exe_real(exe_name: []const u8, path: std.Build.LazyPath, b: *std.Build) ! b.installArtifact(exe); + const bin_name = try std.fmt.allocPrint(b.allocator, "{s}.bin", .{exe_name}); + defer b.allocator.free(bin_name); + + const copy = b.addObjCopy(exe.getEmittedBin(), .{ + .format = .bin, + }); + copy.step.dependOn(&exe.step); + + const install_bin = b.addInstallBinFile(copy.getOutput(), bin_name); + b.getInstallStep().dependOn(&install_bin.step); + return exe; } @@ -127,18 +138,7 @@ fn lab(name: []const u8, units: []const []const u8, b: *std.Build, add_exe: add_ _ = try file.write(root_src); file.close(); - const exe = try add_exe(exe_name, relative_path, b); - - const bin_name = try std.fmt.allocPrint(b.allocator, "{s}_{s}.bin", .{ name, unit }); - defer b.allocator.free(bin_name); - - const copy = b.addObjCopy(exe.getEmittedBin(), .{ - .format = .bin, - }); - copy.step.dependOn(&exe.step); - - const install_bin = b.addInstallBinFile(copy.getOutput(), bin_name); - b.getInstallStep().dependOn(&install_bin.step); + _ = try add_exe(exe_name, relative_path, b); } }