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)