3dtoys/Makefile

32 lines
651 B
Makefile
Raw Normal View History

2024-08-13 01:28:24 +00:00
# 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):
2024-08-13 02:03:55 +00:00
cd haloo3d && $(MAKE) full
2024-08-13 01:28:24 +00:00
# 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)
2024-08-13 01:47:01 +00:00
$(CC) $(CFLAGS) $< $(HALOOLIB) -o $@ -lm -lSDL
2024-08-13 01:28:24 +00:00
# Rule to clean the build files
clean:
rm -rf $(BUILDD)
find . -name "*.exe" -type f -delete
2024-08-13 02:17:14 +00:00
cd haloo3d && $(MAKE) clean
2024-08-13 01:28:24 +00:00