From c422730236a3c2bdac83bb929b47a2feaf632c4c Mon Sep 17 00:00:00 2001 From: Nicolas Gresset-Bourgeois Date: Fri, 6 Dec 2024 10:36:04 +0100 Subject: [PATCH] another foo commit for testing verifying --- Makefile | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index d2bfd8a..9eeb8fb 100644 --- a/Makefile +++ b/Makefile @@ -1,25 +1,29 @@ -CC ?= gcc -CFLAGS ?= -Wall -g -Wextra -O3 -LDLIBS ?= -lm +CC := gcc +CFLAGS := -Wall -g -Wextra -O3 +LDLIBS := -lm INCLUDE_PATH = ./include - -TARGET =main - SRCDIR = src OBJDIR = obj BINDIR = bin +TEST_DIR = test +TEST_SRC = $(TEST_DIR)/test.c +TEST_BIN = $(TEST_DIR)/test + +program := main +test-program := test-main + +test-sources := $(wildcard TEST_DIR/*.c) +test-objects := $(test-sources:.c=.o) SOURCES := $(wildcard $(SRCDIR)/*.c) INCLUDES := $(wildcard $(INCLUDE_PATH)/*.h) OBJECTS := $(SOURCES:$(SRCDIR)/%.c=$(OBJDIR)/%.o) -TEST_DIR = test -TEST_SRC = $(TEST_DIR)/test.c -TEST_BIN = $(TEST_DIR)/test -$(BINDIR)/$(TARGET): $(OBJECTS) + +$(BINDIR)/$(program): $(OBJECTS) mkdir -p $(BINDIR) $(CC) -o $@ $^ $(CFLAGS) $(LDLIBS) @echo "Linking complete!" @@ -33,10 +37,12 @@ doc: test: $(TEST_BIN) -$(TEST_BIN): $(TEST_SRC) - $(CC) $(CFLAGS) -o $(TEST_BIN) $(TEST_SRC) +$(TEST_BIN): $(OBJECTS) $(TEST_SRC) + @ $(CC) $(CFLAGS) $(LDLIBS) $(OBJECTS) -o $(TEST_BIN) $(TEST_SRC) + .PHONY: clean clean: rm -rf obj/*.o rm -f bin/arbres + rm -f test/test