From 671a58519ef6207b54947ff70eea497ff7eb58ae Mon Sep 17 00:00:00 2001 From: Thomas Vanbesien Date: Sat, 21 Feb 2026 15:49:06 +0100 Subject: Restructure project layout and clean up test suite Move sources to src/, header to inc/, and tests to tests/src/. Update Makefiles and .gitignore for the new layout. Refactor test harness: add crash-wrapper macros (_S_CRASH, _S_CRASH_I, _S_CRASH_V, _S_CRASH_BUF) replacing 58 hand-written wrappers, add shared _s_test_int_range helper eliminating duplicate _s_test_func, add _S_RAND_ITERS constant, move srand() to main() in all test binaries, and add Doxygen comments to test_utils.h. --- Makefile | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 55e0d7b..c1af191 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,13 @@ -NAME = libft.a - CC = cc CFLAGS = -Wall -Wextra -Werror +SRCDIR = src +INCDIR = inc +OBJDIR = obj +LIBDIR = lib + +NAME = $(LIBDIR)/libft.a + SRCS = ft_isalpha.c ft_isdigit.c ft_isalnum.c ft_isascii.c ft_isprint.c \ ft_strlen.c ft_memset.c ft_bzero.c ft_memcpy.c ft_memmove.c \ ft_memchr.c ft_memcmp.c ft_strncmp.c \ @@ -11,18 +16,25 @@ SRCS = ft_isalpha.c ft_isdigit.c ft_isalnum.c ft_isascii.c ft_isprint.c \ ft_calloc.c ft_strdup.c \ ft_toupper.c ft_tolower.c -OBJS = $(SRCS:.c=.o) +OBJS = $(SRCS:%.c=$(OBJDIR)/%.o) -$(NAME): $(OBJS) +$(NAME): $(OBJS) | $(LIBDIR) ar rcs $(NAME) $(OBJS) all: $(NAME) +$(OBJDIR)/%.o: $(SRCDIR)/%.c | $(OBJDIR) + $(CC) $(CFLAGS) -I $(INCDIR) -c $< -o $@ + +$(OBJDIR): + mkdir -p $(OBJDIR) + clean: - rm -f $(OBJS) + rm -rf $(OBJDIR) fclean: clean rm -f $(NAME) + $(MAKE) -C tests clean re: fclean all -- cgit v1.2.3