31 lines
622 B
Makefile
31 lines
622 B
Makefile
# 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 -lSDL
|
|
|
|
# Rule to clean the build files
|
|
clean:
|
|
rm -rf $(BUILDD)
|
|
find . -name "*.exe" -type f -delete
|
|
|