From 3efae0c6230e0cd5a3ce8c978ba7a970f4ae3237 Mon Sep 17 00:00:00 2001 From: Philippe Pittoli Date: Fri, 6 May 2022 00:50:53 +0200 Subject: [PATCH] Makefile. --- Makefile | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..893b2d9 --- /dev/null +++ b/Makefile @@ -0,0 +1,30 @@ +all: global-compilation + +OPT_CACHE = --global-cache-dir /tmp/.global-cache-dir +OPT_MODE = ReleaseSmall +#OPT_MODE = ReleaseFast +#OPT_MODE = ReleaseSafe +#OPT_MODE = Debug +OPT_STRIP = --strip +opts = -O $(OPT_MODE) $(OPT_CACHE) $(OPT_STRIP) + +individual_apps != ls src/*.zig |\ + grep -v lib.zig |\ + grep -v zig-cache |\ + grep -v test.zig |\ + sed "s_src/__" |\ + sed "s/.zig$$//" + +$(individual_apps): + @echo $@ + @zig build-exe $(opts) src/$@.zig + +individual-compilation: + @echo "individual apps: $(individual_apps)" + @for i in $(individual_apps); do echo "$${i}"; zig build-exe $(opts) src/$${i}.zig; done + +global-compilation: src/main.zig + zig build-exe $(opts) src/main.zig + + +.PHONY: $(global-compilation) $(individual-compilation)