const std = @import("std"); pub fn build(b: *std.Build) void { const target = b.standardTargetOptions(.{}); const optimize = b.standardOptimizeOption(.{}); const install_all = b.step("install-all", "Install all days"); const run_all = b.step("run-all", "Run all days"); const num_days = b.option(u32, "num-days", "The number of days to process") orelse 25; var day: u8 = 1; while (day <= num_days) : (day += 1) { const str = b.fmt("day{d}", .{day}); const file = b.fmt("{s}.zig", .{str}); const exe = b.addExecutable(.{ .name = str, .root_source_file = b.path(file), .target = target, .optimize = optimize, }); const install_exe = b.addInstallArtifact(exe, .{}); const install_step = b.step(b.fmt("install_{s}", .{str}), b.fmt("Install {s}", .{str})); install_step.dependOn(&install_exe.step); install_all.dependOn(&install_exe.step); const run_exe = b.addRunArtifact(exe); const run_step = b.step(b.fmt("run_{s}", .{str}), b.fmt("Run {s}", .{str})); run_step.dependOn(&run_exe.step); run_all.dependOn(&run_exe.step); } }