minishell/tests/Makefile

34 lines
658 B
Makefile
Raw Normal View History

rawtests = \
2025-02-18 15:07:05 +01:00
env_manip \
metacharacters \
tests = $(addprefix test_,$(rawtests))
test_objs = $(addsuffix .o,$(tests))
objs := $(addprefix ../,$(objs))
all_objs = $(objs) $(test_objs)
deps = $(all_objs:.o=.d)
2025-02-13 15:17:30 +01:00
LDLIBS = \
-lreadline \
-lft
LIBFTDIR = ../libft/
LIBFT = $(LIBFTDIR)libft.a
IFLAGS = -I$(LIBFTDIR)
LINCLUDE = -L$(LIBFTDIR)
.PHONY: run
run: $(tests)
$(addprefix ./,$(addsuffix &&,$(tests))) echo "Finished running C tests"
-include $(deps)
%.o: %.c
2025-02-13 15:17:30 +01:00
$(CC) -c $(CFLAGS) $(IFLAGS) -o $*.o $*.c
$(CC) -MM $(CFLAGS) $(IFLAGS) $*.c > $*.d
test_%: %.o $(objs)
2025-02-13 15:17:30 +01:00
$(CC) $(CFLAGS) -o $@ $*.o $(objs) $(LINCLUDE) $(LDLIBS)
fclean:
rm -f $(tests)