From 61f25dc10b8a34726941bce7353733f04db971c8 Mon Sep 17 00:00:00 2001 From: Carlos Sanchez Date: Mon, 12 Aug 2024 21:28:24 -0400 Subject: [PATCH] Setup makefile --- Makefile | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..993fd3b --- /dev/null +++ b/Makefile @@ -0,0 +1,30 @@ +# Compiler and other things +CC = gcc +CFLAGS = -std=c99 -Wall -Wextra -Werror -O3 -flto +BUILDD = build + +HALOOLIB = haloo3d/build/haloo3d_full.a + +.PHONY: clean +.PHONY: full + +full: + echo "Please specify a sample to build (ends with .exe)" + +$(HALOOLIB): + cd haloo3d && make full + +# Rule to build .o files in main folder +$(BUILDD)/%.o: %.c %.h + mkdir -p $(BUILDD) + $(CC) $(CFLAGS) -c $< -o $@ + +# Rule to build any sample. We ALWAYS need math so... link it +%.exe: %.o $(HALOOLIB) + $(CC) $(CFLAGS) $< $(HALOOLIB) -o $@ -lm + +# Rule to clean the build files +clean: + rm -rf $(BUILDD) + find . -name "*.exe" -type f -delete +