73 lines
1.8 KiB
Makefile
73 lines
1.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
|
|
|
|
# --------------------------
|
|
# 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
|
|
|
|
# pattern rule to build .o from .c
|
|
%.o: %.c
|
|
$(CC) -c $(FLAGS) $< -o $@
|
|
|
|
# --------------------------
|
|
# Unit Tests
|
|
# --------------------------
|
|
unitTests: test_stack test_numbers test_bintree
|
|
@total=0; passed=0; failed=0; \
|
|
for t in test_stack test_numbers test_bintree; do \
|
|
total=$$((total+1)); \
|
|
printf "Running %s...\n" "$$t"; \
|
|
./$$t; rc=$$?; \
|
|
if [ $$rc -eq 0 ]; then \
|
|
printf "%s: PASS\n\n" "$$t"; \
|
|
passed=$$((passed+1)); \
|
|
else \
|
|
printf "%s: FAIL (exit %d)\n\n" "$$t" $$rc; \
|
|
failed=$$((failed+1)); \
|
|
fi; \
|
|
done; \
|
|
printf "Summary: %d tests run, %d passed, %d failed\n" $$total $$passed $$failed; \
|
|
exit $$failed
|
|
|
|
test_stack: test_stack.c stack.c
|
|
$(CC) $(FLAGS) test_stack.c stack.c -o test_stack
|
|
|
|
test_numbers: test_numbers.c numbers.c bintree.c stack.c
|
|
$(CC) $(FLAGS) test_numbers.c numbers.c bintree.c stack.c -o test_numbers
|
|
|
|
test_bintree: test_bintree.c bintree.c stack.c
|
|
$(CC) $(FLAGS) test_bintree.c bintree.c stack.c -o test_bintree
|
|
|
|
# --------------------------
|
|
# Clean
|
|
# --------------------------
|
|
clean:
|
|
ifeq ($(OS),Windows_NT)
|
|
del /f *.o doble
|
|
else
|
|
rm -f *.o doble
|
|
endif |