99 lines
2.8 KiB
Makefile
99 lines
2.8 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
|
|
|
|
# --------------------------
|
|
# 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
|
|
|
|
# --------------------------
|
|
# Selbst implementiertes Programm bauen
|
|
# --------------------------
|
|
program_obj_files = stack.o bintree.o numbers.o timer.o highscore.o
|
|
|
|
doble: main.o $(program_obj_files)
|
|
$(CC) $(FLAGS) $^ -o doble
|
|
|
|
# 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
|
|
# --------------------------
|
|
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 doble_initial test_stack test_numbers
|
|
else
|
|
rm -f *.o doble doble_initial test_stack test_numbers
|
|
endif |