From c7a86eecfd5c5deda902509e1b6a33b1810bcf96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kha=C3=AFs=20COLIN?= Date: Thu, 13 Feb 2025 15:17:30 +0100 Subject: [PATCH] tests: tests can now use libft --- Makefile | 2 +- tests/Makefile | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index a6648f9..e69db38 100644 --- a/Makefile +++ b/Makefile @@ -76,5 +76,5 @@ tests: @echo "All tests passed!" -ctests: +ctests: $(LIBFT) +make -C tests diff --git a/tests/Makefile b/tests/Makefile index 6b8ba24..b295b71 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -6,6 +6,13 @@ test_objs = $(addsuffix .o,$(tests)) objs := $(addprefix ../,$(objs)) all_objs = $(objs) $(test_objs) deps = $(all_objs:.o=.d) +LDLIBS = \ + -lreadline \ + -lft +LIBFTDIR = ../libft/ +LIBFT = $(LIBFTDIR)libft.a +IFLAGS = -I$(LIBFTDIR) +LINCLUDE = -L$(LIBFTDIR) .PHONY: run @@ -15,11 +22,11 @@ run: $(tests) -include $(deps) %.o: %.c - $(CC) -c $(CFLAGS) $(LDFLAGS) -o $*.o $*.c - $(CC) -MM $(CFLAGS) $(LDFLAGS) $*.c > $*.d + $(CC) -c $(CFLAGS) $(IFLAGS) -o $*.o $*.c + $(CC) -MM $(CFLAGS) $(IFLAGS) $*.c > $*.d test_%: %.o $(objs) - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $*.o $(objs) $(LDLIBS) + $(CC) $(CFLAGS) -o $@ $*.o $(objs) $(LINCLUDE) $(LDLIBS) fclean: rm -f $(tests)