minishell/tests/Makefile

25 lines
519 B
Makefile

rawtests = \
metacharacters \
tests = $(addprefix test_,$(rawtests))
test_objs = $(addsuffix .o,$(tests))
objs := $(addprefix ../,$(objs))
all_objs = $(objs) $(test_objs)
deps = $(all_objs:.o=.d)
.PHONY: run
run: $(tests)
$(addprefix ./,$(addsuffix &&,$(tests))) echo "Finished running C tests"
-include $(deps)
%.o: %.c
$(CC) -c $(CFLAGS) $(LDFLAGS) -o $*.o $*.c
$(CC) -MM $(CFLAGS) $(LDFLAGS) $*.c > $*.d
test_%: %.o $(objs)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $*.o $(objs) $(LDLIBS)
fclean:
rm -f $(tests)