From 3120f8adb65ad664950b92a49bca92dc6d38335e Mon Sep 17 00:00:00 2001 From: Miroslav Lichvar Date: Mon, 23 May 2011 15:38:14 +0200 Subject: [PATCH] Use object dependencies in Makefile --- Makefile.in | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/Makefile.in b/Makefile.in index 4dab13f..a2ac0b7 100644 --- a/Makefile.in +++ b/Makefile.in @@ -49,6 +49,8 @@ EXTRA_OBJS=@EXTRA_OBJECTS@ CLI_OBJS = client.o md5.o nameserv.o getdate.o cmdparse.o \ pktlength.o util.o +ALL_OBJS = $(OBJS) $(EXTRA_OBJS) $(CLI_OBJS) + SRCS = $(patsubst %.o,%.c,$(OBJS)) EXTRA_SRCS = $(patsubst %.o,%.c,$(EXTRA_OBJS)) @@ -79,14 +81,12 @@ conf.o : conf.c client.o : client.c $(CC) $(CFLAGS) $(CPPFLAGS) @READLINE_COMPILE@ -c $< -.depend : - gcc -MM $(SRCS) $(EXTRA_SRCS) > .depend - -distclean : - -rm -f *.o *.s chronyc chronyd core options.h Makefile *~ +distclean : clean + -rm -f Makefile clean : -rm -f *.o *.s chronyc chronyd core *~ + -rm -rf .deps version.h : version.txt ./mkversion @@ -163,3 +163,10 @@ chrony.info : chrony.texi faq.php : faq.txt faqgen.pl perl faqgen.pl < faq.txt > faq.php +.deps: + @mkdir .deps + +.deps/%.d: %.c .deps + @$(CC) -MM $(CPPFLAGS) -MT '$(<:%.c=%.o) $@' $< -o $@ + +-include $(ALL_OBJS:%.o=.deps/%.d)