]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
Use object dependencies in Makefile
authorMiroslav Lichvar <mlichvar@redhat.com>
Mon, 23 May 2011 13:38:14 +0000 (15:38 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Tue, 24 May 2011 16:06:49 +0000 (18:06 +0200)
Makefile.in

index 4dab13f6afaf7d4fdceaab2af7f00472b12ec0db..a2ac0b72be08c3e8377b865029da09bbea31e81b 100644 (file)
@@ -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)