Last active
October 3, 2020 17:28
-
-
Save mattnite/f4cc0f21bd247ee22ff5d9f68a6f2be0 to your computer and use it in GitHub Desktop.
Minimal build script for BPF programs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const std = @import("std"); | |
const Builder = std.build.Builder; | |
const builtin = @import("builtin"); | |
pub fn build(b: *Builder) void { | |
const target = b.standardTargetOptions(.{}); | |
const obj = b.addObject("probe", "src/probe.zig"); | |
obj.setTarget(std.zig.CrossTarget{ | |
.cpu_arch = switch ((target.cpu_arch orelse builtin.arch).endian()) { | |
.Big => .bpfeb, | |
.Little => .bpfel, | |
}, | |
.os_tag = .freestanding, | |
}); | |
obj.setBuildMode(.ReleaseFast); | |
obj.setOutputDir("src"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment