Skip to content

Commit b835c65

Browse files
committed
add cflags
1 parent ec20611 commit b835c65

1 file changed

Lines changed: 29 additions & 3 deletions

File tree

build.zig

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ pub fn build(b: *std.Build) void {
2020
}),
2121
});
2222
maketab.addIncludePath(awkgram_tab.dirname());
23-
maketab.addCSourceFile(.{ .file = awk_dep.path("maketab.c") });
23+
maketab.addCSourceFile(.{
24+
.file = awk_dep.path("maketab.c"),
25+
.flags = flags,
26+
});
2427
const mt_run = b.addRunArtifact(maketab);
2528
mt_run.addFileArg(awkgram_tab.dirname().path(b, "awkgram.tab.h"));
2629
const w_proc = b.addWriteFiles();
@@ -33,8 +36,14 @@ pub fn build(b: *std.Build) void {
3336
});
3437
mod.addIncludePath(awk_dep.path(""));
3538
mod.addIncludePath(awkgram_tab.dirname());
36-
mod.addCSourceFile(.{ .file = proctab });
37-
mod.addCSourceFile(.{ .file = awkgram_tab });
39+
mod.addCSourceFile(.{
40+
.file = proctab,
41+
.flags = flags,
42+
});
43+
mod.addCSourceFile(.{
44+
.file = awkgram_tab,
45+
.flags = flags,
46+
});
3847
mod.addCSourceFiles(.{
3948
.files = &.{
4049
"tran.c",
@@ -46,11 +55,28 @@ pub fn build(b: *std.Build) void {
4655
"b.c",
4756
},
4857
.root = awk_dep.path(""),
58+
.flags = flags,
4959
});
60+
// mod.addIncludePath(b.path("src"));
5061

5162
const exe = b.addExecutable(.{
5263
.name = "awk",
5364
.root_module = mod,
5465
});
5566
b.installArtifact(exe);
5667
}
68+
69+
const flags = &.{
70+
"-fno-optimize-sibling-calls",
71+
"-Wall",
72+
"-Wextra",
73+
"-Werror",
74+
"-pedantic",
75+
"-Wno-unused-parameter",
76+
"-Wno-unused-but-set-variable",
77+
"-Wno-strict-prototypes",
78+
// "-Wno-inconsistent-dllimport",
79+
// "-Wno-implicit-function-declaration",
80+
// "-Wno-void-pointer-to-int-cast",
81+
// "-Wno-int-to-pointer-cast",
82+
};

0 commit comments

Comments
 (0)