add makefile

This commit is contained in:
fonkou 2025-12-02 15:58:36 +01:00
parent 941374cbc2
commit 526f1c3884

View File

@ -1,8 +1,12 @@
# --------------------------
# Compiler & Flags
# --------------------------
CC = gcc CC = gcc
FLAGS = -g -Wall -lm FLAGS = -g -Wall
ifeq ($(OS),Windows_NT) ifeq ($(OS),Windows_NT)
include makefile_windows.variables include makefile_windows.variables
RM = del /f
else else
UNAME = $(shell uname) UNAME = $(shell uname)
ifeq ($(UNAME),Linux) ifeq ($(UNAME),Linux)
@ -10,40 +14,49 @@ else
else else
include makefile_mac.variables include makefile_mac.variables
endif endif
RM = rm -f
endif endif
raylibfolder = ./raylib raylibfolder = ./raylib
unityfolder = ./unity 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: doble_initial:
$(CC) -o doble_initial $(BINARIES)/libdoble_complete.a $(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) # Compile testStack.c en un exécutable testStack
$(CC) $(FLAGS) $^ -o doble 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 testStack.o: testStack.c
$(CC) -c $(FLAGS) $^ -o $@ $(CC) $(FLAGS) -c testStack.c -o testStack.o
# --------------------------
# Unit Tests
# --------------------------
unitTests:
echo "needs to be implemented"
# -------------------------- # --------------------------
# Clean # Clean
# -------------------------- # --------------------------
clean: clean:
ifeq ($(OS),Windows_NT) $(RM) *.o doble testStack doble_initial
del /f *.o doble
else
rm -f *.o doble
endif