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 +