2025-12-08 14:00:19 +01:00

83 lines
1.7 KiB
Makefile

CC = gcc
FLAGS = -g -Wall -lm
ifeq ($(OS),Windows_NT)
include makefile_windows.variables
else
UNAME = $(shell uname)
ifeq ($(UNAME),Linux)
include makefile_linux.variables
else
include makefile_mac.variables
endif
endif
raylibfolder = ./raylib
unityfolder = ./unity
# --------------------------
# Hauptprogramm bauen
# --------------------------
program_obj_files = stack.o bintree.o numbers.o timer.o highscore.o
doble: main.o $(program_obj_files)
$(CC) $(FLAGS) $^ -o doble
main.o: main.c
$(CC) -c $(FLAGS) main.c -o main.o
$(program_obj_filesobj_files): %.o: %.c
$(CC) -c $(FLAGS) $^ -o $@
# --------------------------
# Unit Tests
# --------------------------
unitTests: test_stack test_numbers
./test_stack
./test_numbers
# --- Test Stack ---
test_stack: test_stack.o stack.o
$(CC) $(FLAGS) $^ -o test_stack
test_stack.o: test_stack.c stack.h
$(CC) -c $(FLAGS) test_stack.c -o test_stack.o
# --- Test Numbers ---
test_numbers: test_numbers.o numbers.o bintree.o stack.o
$(CC) $(FLAGS) $^ -o test_numbers
test_numbers.o: test_numbers.c numbers.h
$(CC) -c $(FLAGS) test_numbers.c -o test_numbers.o
# --------------------------
# Objektdateien
# --------------------------
stack.o: stack.c stack.h
$(CC) -c $(FLAGS) stack.c -o stack.o
bintree.o: bintree.c bintree.h stack.h
$(CC) -c $(FLAGS) bintree.c -o bintree.o
numbers.o: numbers.c numbers.h bintree.h
$(CC) -c $(FLAGS) numbers.c -o numbers.o
timer.o: timer.c timer.h
$(CC) -c $(FLAGS) timer.c -o timer.o
highscore.o: highscore.c highscore.h
$(CC) -c $(FLAGS) highscore.c -o highscore.o
# --------------------------
# Clean
# --------------------------
clean:
ifeq ($(OS),Windows_NT)
del /f *.o doble test_stack test_numbers
else
rm -f *.o doble test_stack test_numbers
endif