fix(tests): correctly handle dependencies in test makefile

This commit is contained in:
Khaïs COLIN 2025-02-11 16:13:24 +01:00
parent 71a4df1bb0
commit e877b8dbd5
Signed by: logistic-bot
SSH key fingerprint: SHA256:RlpiqKeXpcPFZZ4y9Ou4xi2M8OhRJovIwDlbCaMsuAo

View file

@ -4,9 +4,16 @@ rawtests = \
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
@ -14,8 +21,5 @@ objs := $(addprefix ../,$(objs))
test_%: %.o $(objs)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $*.o $(objs) $(LDLIBS)
run: $(tests)
$(addprefix ./,$(addsuffix &&,$(tests))) echo "Finished running C tests"
fclean:
rm -f $(tests)