From e033909819ca6ba0b3c1ce3e4f89cb58bde0bce8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kha=C3=AFs=20COLIN?= Date: Tue, 15 Apr 2025 10:29:30 +0200 Subject: [PATCH] makefile: generate depfiles for the correct object files The depfiles were completely ineffective. Now this is fixed. The -MT argument sets the path for the dependenency root. By default it is set only to a filename, and thus does not include the full path of the file. --- Makefile | 2 +- tests/Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 7852e81..b32e18d 100644 --- a/Makefile +++ b/Makefile @@ -117,7 +117,7 @@ $(LIBFT): %.o: %.c $(CC) -c $(CFLAGS) $(IFLAGS) -o $*.o $*.c - $(CC) -MM $(CFLAGS) $(IFLAGS) $*.c > $*.d + $(CC) -MM $(CFLAGS) $(IFLAGS) -MT $*.o $*.c > $*.d clean: +$(MAKE) -C $(LIBFTDIR) clean diff --git a/tests/Makefile b/tests/Makefile index 687d030..82f1e9f 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -44,7 +44,7 @@ run: $(run_tests) %.o: %.c $(CC) -c $(CFLAGS) $(IFLAGS) -o $*.o $*.c - $(CC) -MM $(CFLAGS) $(IFLAGS) $*.c > $*.d + $(CC) -MM $(CFLAGS) $(IFLAGS) -MT $*.o $*.c > $*.d test_%: %.o $(objs) $(CC) $(CFLAGS) -rdynamic -o $@ $*.o $(objs) $(LINCLUDE) $(LDLIBS)