diff --git a/makefile b/makefile index 1f15f75..35f5b7a 100644 --- a/makefile +++ b/makefile @@ -1,8 +1,12 @@ +# -------------------------- +# Compiler & Flags +# -------------------------- CC = gcc -FLAGS = -g -Wall -lm +FLAGS = -g -Wall ifeq ($(OS),Windows_NT) include makefile_windows.variables + RM = del /f else UNAME = $(shell uname) ifeq ($(UNAME),Linux) @@ -10,40 +14,49 @@ else else include makefile_mac.variables endif + RM = rm -f endif raylibfolder = ./raylib unityfolder = ./unity # -------------------------- -# Initiales Programm bauen (zum ausprobieren) +# Objects du programme +# -------------------------- +program_obj_files = stack.o bintree.o numbers.o timer.o highscore.o + +# -------------------------- +# Cible principale +# -------------------------- +doble : main.o $(program_obj_files) + $(CC) $(FLAGS) $^ -o $@ + +%.o : %.c + $(CC) $(FLAGS) -c $< -o $@ + +# -------------------------- +# Programme initial # -------------------------- doble_initial: $(CC) -o doble_initial $(BINARIES)/libdoble_complete.a # -------------------------- -# Selbst implementiertes Programm bauen +# Tests unitaires # -------------------------- -program_obj_files = stack.o bintree.o numbers.o timer.o highscore.o -doble : main.o $(program_obj_files) - $(CC) $(FLAGS) $^ -o doble +# Compile testStack.c en un exécutable testStack +unitTests: testStack.o stack.o + $(CC) $(FLAGS) testStack.o stack.o -o testStack + @echo "----------------------------" + @echo "Running unit tests..." + ./testStack + @echo "----------------------------" -$(program_obj_filesobj_files): %.o: %.c - $(CC) -c $(FLAGS) $^ -o $@ - -# -------------------------- -# Unit Tests -# -------------------------- -unitTests: - echo "needs to be implemented" +testStack.o: testStack.c + $(CC) $(FLAGS) -c testStack.c -o testStack.o # -------------------------- # Clean # -------------------------- clean: -ifeq ($(OS),Windows_NT) - del /f *.o doble -else - rm -f *.o doble -endif \ No newline at end of file + $(RM) *.o doble testStack doble_initial