# --------------------------
# Variablen
# --------------------------
raylib_folder = ./raylib
unity_folder = ./unity
BINARIES = ./windows

CC = gcc
CFLAGS = -g -Wall -I$(raylib_folder)
LDFLAGS = -lopengl32 -lgdi32 -lwinmm
TEST_BIN = runTests

# --------------------------
# Ziel: Normales Spiel bauen
# --------------------------
all: wordsalad

wordsalad: main.o input.o game.o graphicalGame.o $(BINARIES)/libraylib.a
	$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)

main.o: main.c
	$(CC) -c $(CFLAGS) $< -o $@

input.o: input.c
	$(CC) -c $(CFLAGS) $< -o $@

game.o: game.c
	$(CC) -c $(CFLAGS) $< -o $@

graphicalGame.o: graphicalGame.c
	$(CC) -c $(CFLAGS) $< -o $@

# --------------------------
# Ziel: Initiales Spiel bauen
# --------------------------
wordsalad_initial:
	$(CC) -o $@ $(BINARIES)/libwordsalad_complete.a $(BINARIES)/libraylib.a $(LDFLAGS)

# --------------------------
# Ziel: Unit Tests
# --------------------------
test: $(TEST_BIN)

$(TEST_BIN): input.o game.o unit_tests.c
	$(CC) $(CFLAGS) -I$(unity_folder) -o $@ input.o game.o unit_tests.c $(BINARIES)/libunity.a

# --------------------------
# Ziel: Aufräumen
# --------------------------
clean:
	rm -f *.o wordsalad wordsalad_initial $(TEST_BIN)