Fertig
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
CC = gcc
|
||||
CC = gcc
|
||||
FLAGS = -g -Wall -lm
|
||||
|
||||
ifeq ($(OS),Windows_NT)
|
||||
@@ -13,10 +13,18 @@ else
|
||||
endif
|
||||
|
||||
raylibfolder = ./raylib
|
||||
unityfolder = ./unity
|
||||
unityfolder = ./unity
|
||||
|
||||
# --------------------------
|
||||
# Initiales Programm bauen (zum ausprobieren)
|
||||
# Phony Targets
|
||||
# --------------------------
|
||||
.PHONY: all doble doble_initial unitTests test_stack test_numbers clean vorbereitungen prepare
|
||||
|
||||
# Standard-Target
|
||||
all: doble
|
||||
|
||||
# --------------------------
|
||||
# Initiales Programm bauen (zum Ausprobieren)
|
||||
# --------------------------
|
||||
doble_initial:
|
||||
$(CC) -o doble_initial $(BINARIES)/libdoble_complete.a
|
||||
@@ -26,24 +34,66 @@ doble_initial:
|
||||
# --------------------------
|
||||
program_obj_files = stack.o bintree.o numbers.o timer.o highscore.o
|
||||
|
||||
doble : main.o $(program_obj_files)
|
||||
doble: main.o $(program_obj_files)
|
||||
$(CC) $(FLAGS) $^ -o doble
|
||||
|
||||
$(program_obj_filesobj_files): %.o: %.c
|
||||
$(CC) -c $(FLAGS) $^ -o $@
|
||||
# Generische Regel zum Bauen von .o aus .c
|
||||
%.o: %.c
|
||||
$(CC) $(FLAGS) -c $< -o $@
|
||||
|
||||
# Abhängigkeiten (optional, aber hilfreich für inkrementelles Bauen)
|
||||
main.o: main.c numbers.h stack.h bintree.h timer.h highscore.h
|
||||
numbers.o: numbers.c numbers.h bintree.h
|
||||
bintree.o: bintree.c bintree.h stack.h
|
||||
stack.o: stack.c stack.h
|
||||
timer.o: timer.c timer.h
|
||||
highscore.o: highscore.c highscore.h
|
||||
|
||||
test_stack.o: test_stack.c stack.h
|
||||
test_numbers.o: test_numbers.c numbers.h bintree.h stack.h
|
||||
|
||||
# --------------------------
|
||||
# Unit Tests
|
||||
# --------------------------
|
||||
unitTests:
|
||||
echo "needs to be implemented"
|
||||
test_stack: test_stack.o stack.o
|
||||
$(CC) $(FLAGS) $^ -o test_stack
|
||||
|
||||
test_numbers: test_numbers.o numbers.o stack.o bintree.o
|
||||
$(CC) $(FLAGS) $^ -o test_numbers
|
||||
|
||||
unitTests: test_stack test_numbers
|
||||
./test_stack
|
||||
./test_numbers
|
||||
|
||||
# --------------------------
|
||||
# Vorbereitungen zum Bauen des Programms
|
||||
# --------------------------
|
||||
vorbereitungen:
|
||||
@echo "== Vorbereitungen zum Bauen des Programms =="
|
||||
@echo "Prüfe benötigte Dateien..."
|
||||
@test -f numbers.c || (echo "FEHLT: numbers.c" && exit 1)
|
||||
@test -f numbers.h || (echo "FEHLT: numbers.h" && exit 1)
|
||||
@test -f bintree.c || (echo "FEHLT: bintree.c" && exit 1)
|
||||
@test -f bintree.h || (echo "FEHLT: bintree.h" && exit 1)
|
||||
@test -f stack.c || (echo "FEHLT: stack.c" && exit 1)
|
||||
@test -f stack.h || (echo "FEHLT: stack.h" && exit 1)
|
||||
@test -f timer.c || (echo "FEHLT: timer.c" && exit 1)
|
||||
@test -f timer.h || (echo "FEHLT: timer.h" && exit 1)
|
||||
@test -f highscore.c || (echo "FEHLT: highscore.c" && exit 1)
|
||||
@test -f highscore.h || (echo "FEHLT: highscore.h" && exit 1)
|
||||
@test -f main.c || (echo "FEHLT: main.c" && exit 1)
|
||||
@echo "Alle Dateien vorhanden."
|
||||
@echo "Vorbereitung abgeschlossen!"
|
||||
|
||||
# englischer Alias
|
||||
prepare: vorbereitungen
|
||||
|
||||
# --------------------------
|
||||
# Clean
|
||||
# --------------------------
|
||||
clean:
|
||||
ifeq ($(OS),Windows_NT)
|
||||
del /f *.o doble
|
||||
del /f *.o doble doble_initial test_stack test_numbers
|
||||
else
|
||||
rm -f *.o doble
|
||||
rm -f *.o doble doble_initial test_stack test_numbers
|
||||
endif
|
||||
Reference in New Issue
Block a user