const std = @import("std");

pub fn build(b: *std.Build) void {
    const target = b.standardTargetOptions(.{});
    const optimize = b.standardOptimizeOption(.{});

    const exe = b.addExecutable(.{
        .name = "nmap",
        .root_module = b.createModule(.{
            .root_source_file = b.path("src/main.zig"),
            .target = target,
            .optimize = optimize,
        }),
    });
    b.installArtifact(exe);

    const exe_run = b.addRunArtifact(exe);
    const exe_run_step = b.step("run", "Run");
    exe_run_step.dependOn(&exe_run.step);
    exe_run.step.dependOn(b.getInstallStep());
    if (b.args) |args| exe_run.addArgs(args);

    const exe_test = b.addTest(.{ .root_module = exe.root_module });
    const exe_test_step = b.step("test", "Run tests");
    exe_test_step.dependOn(&b.addRunArtifact(exe_test).step);
}
