tests: tests can now use libft

This commit is contained in:
Khaïs COLIN 2025-02-13 15:17:30 +01:00
parent da447a2491
commit c7a86eecfd
Signed by: logistic-bot
SSH key fingerprint: SHA256:RlpiqKeXpcPFZZ4y9Ou4xi2M8OhRJovIwDlbCaMsuAo
2 changed files with 11 additions and 4 deletions

View file

@ -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)