Setup makefile

This commit is contained in:
Carlos Sanchez 2024-08-12 21:28:24 -04:00
parent 34a11bbdb4
commit 61f25dc10b

30
Makefile Normal file
View File

@ -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