aboutsummaryrefslogtreecommitdiff
path: root/std/build.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2019-02-25 14:27:03 -0500
committerAndrew Kelley <andrew@ziglang.org>2019-02-25 14:27:03 -0500
commit33cbb29def181ee758b1f8bb93d8d81a4e377ce1 (patch)
treef6e9ea25cfa8ed5312c864f8075aae5a0d58aa46 /std/build.zig
parent6003b1ea7018fe6a7aa87622d1178e444e6d8abb (diff)
downloadzig-33cbb29def181ee758b1f8bb93d8d81a4e377ce1.tar.gz
zig-33cbb29def181ee758b1f8bb93d8d81a4e377ce1.zip
zig build: 2 improvements
* `linkLibrary` will make the target depend on libc if the source does * when building C source file(s), don't try to generate .h files
Diffstat (limited to 'std/build.zig')
-rw-r--r--std/build.zig6
1 files changed, 5 insertions, 1 deletions
diff --git a/std/build.zig b/std/build.zig
index 0d03b0325f..d88a9b3270 100644
--- a/std/build.zig
+++ b/std/build.zig
@@ -1011,6 +1011,10 @@ pub const LibExeObjStep = struct {
self.full_path_libs.append(lib.getOutputPath()) catch unreachable;
}
+ if (lib.link_libs.exists("c")) {
+ self.link_libs.put("c") catch unreachable;
+ }
+
// TODO should be some kind of isolated directory that only has this header in it
self.include_dirs.append(self.builder.cache_root) catch unreachable;
self.need_flat_namespace_hack = true;
@@ -1266,7 +1270,7 @@ pub const LibExeObjStep = struct {
zig_args.append(output_lib_path) catch unreachable;
}
- if (self.kind != Kind.Exe) {
+ if (self.kind != Kind.Exe and self.root_src != null) {
const output_h_path = self.getOutputHPath();
zig_args.append("--output-h") catch unreachable;
zig_args.append(builder.pathFromRoot(output_h_path)) catch unreachable;