diff options
| author | Thomas Vanbesien <tvanbesi@proton.me> | 2026-02-21 15:49:06 +0100 |
|---|---|---|
| committer | Thomas Vanbesien <tvanbesi@proton.me> | 2026-02-21 15:51:44 +0100 |
| commit | 671a58519ef6207b54947ff70eea497ff7eb58ae (patch) | |
| tree | 783a971119bfed965113b84bc306ba941e884663 /Makefile | |
| parent | d699849b2360f90c61f645c5d4d4232cd3e1c962 (diff) | |
| download | Libft-671a58519ef6207b54947ff70eea497ff7eb58ae.tar.gz Libft-671a58519ef6207b54947ff70eea497ff7eb58ae.zip | |
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.
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 22 |
1 files changed, 17 insertions, 5 deletions
@@ -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 |
