mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 14:23:09 +00:00
35 lines
1023 B
Zig
35 lines
1023 B
Zig
const std = @import("std");
|
|
|
|
pub fn build(b: *std.Build) void {
|
|
const test_step = b.step("test", "Test it");
|
|
b.default_step = test_step;
|
|
|
|
const target = b.standardTargetOptions(.{});
|
|
const optimize = b.standardOptimizeOption(.{});
|
|
|
|
if (target.result.ofmt != .elf or !(target.result.abi.isMusl() or target.result.abi.isGnu()))
|
|
return;
|
|
|
|
const exe = b.addExecutable(.{
|
|
.name = "main",
|
|
.root_module = b.createModule(.{
|
|
.root_source_file = null,
|
|
.optimize = optimize,
|
|
.target = target,
|
|
.link_libc = true,
|
|
}),
|
|
});
|
|
exe.root_module.addCSourceFile(.{
|
|
.file = b.path("main.c"),
|
|
.flags = &.{},
|
|
});
|
|
exe.link_gc_sections = false;
|
|
exe.bundle_compiler_rt = true;
|
|
|
|
// Verify compiler_rt hasn't pulled in any debug handlers
|
|
const check_exe = exe.checkObject();
|
|
check_exe.checkInSymtab();
|
|
check_exe.checkNotPresent("debug.readElfDebugInfo");
|
|
test_step.dependOn(&check_exe.step);
|
|
}
|