Update for Zig 0.12.0-dev.3194+4ba4f94c9.
3 files changed, 19 insertions(+), 10 deletions(-)

M Makefile
M build.zig
M src/main.zig
M Makefile +9 -3
@@ 4,14 4,17 @@ CFLAGS=-Wall -Werror -Wextra -Os -fPIE
 LD=ld
 LDFLAGS=-melf_x86_64 -r --whole-archive
 ZIGOUT=zig-out/lib
-LPATH=-L$(ZIGOUT) -L.
+LPATH=-L.
+ZIG_SRCS=$(wildcard src/*.zig)
 
-.PHONY: clean libadd.a
+.PHONY: clean libadd.a test default
+
+default: main
 
 %.o:: %.c
 	$(CC) -o $@ -c $(CFLAGS) $^
 
-$(ZIGOUT)/libadd.a:
+$(ZIGOUT)/libadd.a: $(ZIG_SRCS)
 	zig fmt build.zig src/*.zig
 	zig build
 

          
@@ 21,6 24,9 @@ libi32math.a: $(ZIGOUT)/libadd.a mul.o
 main: main.o libi32math.a
 	$(CC) -o main $(CFLAGS) $(LPATH) $< -li32math
 
+test: $(ZIG_SRCS)
+	zig build test
+
 clean:
 	rm -f *.o *.a main
 	rm -rf zig-out zig-cache

          
M build.zig +9 -6
@@ 1,6 1,7 @@ 
-const Builder = @import("std").build.Builder;
+const std = @import("std");
+const Build = std.Build;
 
-pub fn build(b: *Builder) void {
+pub fn build(b: *Build) void {
     const target = b.standardTargetOptions(.{});
     const optimize = b.standardOptimizeOption(.{});
 

          
@@ 17,16 18,18 @@ pub fn build(b: *Builder) void {
 
     switch (optimize) {
         .Debug, .ReleaseSafe => lib.bundle_compiler_rt = true,
-        .ReleaseFast, .ReleaseSmall => lib.disable_stack_probing = true,
+        .ReleaseFast, .ReleaseSmall => {},
     }
-    lib.force_pic = true;
+    lib.pie = true;
 
-    var main_tests = b.addTest(.{
+    const main_tests = b.addTest(.{
         .root_source_file = .{ .path = "src/main.zig" },
         .target = target,
         .optimize = optimize,
     });
 
+    const run_main_tests = b.addRunArtifact(main_tests);
+
     const test_step = b.step("test", "Run library tests");
-    test_step.dependOn(&main_tests.step);
+    test_step.dependOn(&run_main_tests.step);
 }

          
M src/main.zig +1 -1
@@ 6,5 6,5 @@ export fn add(a: i32, b: i32) i32 {
 }
 
 test "basic add functionality" {
-    try testing.expect(add(3, 7) == 10);
+    try testing.expectEqual(10, add(3, 7));
 }