Permalink
Browse files

Replace Makefile with build.zig

  • Loading branch information...
tiehuis committed Jul 19, 2017
1 parent 572d12a commit 0704b4455bc23f1dae820fe2791dcc56368e7aaa
Showing with 23 additions and 14 deletions.
  1. +1 −0 .gitignore
  2. +0 −14 Makefile
  3. +22 −0 build.zig
View
@@ -1,2 +1,3 @@
main
build/
zig-cache
View
@@ -1,14 +0,0 @@
SRCS := compute.c compute_helper.c display.c main.c
OBJS := $(SRCS:%.c=build/%.o)
main: $(OBJS)
gcc -o main $(OBJS)
$(OBJS): build/%.o: %.c | mkdirs
gcc -std=c99 -c $< -o $@
mkdirs:
@mkdir -p build
clean:
rm -rf build main
View
@@ -0,0 +1,22 @@
const Builder = @import("std").build.Builder;
pub fn build(b: &Builder) {
const exe = b.addCExecutable("main");
exe.addCompileFlags([][]const u8 {
"-std=c99"
});
const source_files = [][]const u8 {
"compute.c",
"compute_helper.c",
"display.c",
"main.c"
};
for (source_files) |source| {
exe.addSourceFile(source);
}
exe.setOutputPath("./main");
b.default_step.dependOn(&exe.step);
}

0 comments on commit 0704b44

Please sign in to comment.