changeset 26432:7f5696224182

per-file dependencies (for the non-recursive parts)
author diego
date Fri, 18 Apr 2008 22:49:17 +0000
parents 4213401c16a9
children ce655dcca44b
files Makefile mpcommon.mak
diffstat 2 files changed, 14 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Fri Apr 18 21:47:51 2008 +0000
+++ b/Makefile	Fri Apr 18 22:49:17 2008 +0000
@@ -234,9 +234,10 @@
 
 all:	$(ALL_PRG)
 
-.depend: help_mp.h version.h codecs.conf.h
-dep depend:
-	for part in $(PARTS); do $(MAKE) -C $$part depend; done
+DEPS = $(SRCS_COMMON:.c=.d) $(SRCS_MPLAYER:.c=.d) $(SRCS_MENCODER:.c=.d)
+$(DEPS): help_mp.h version.h codecs.conf.h
+dep depend: $(DEPS)
+	for part in $(PARTS); do $(MAKE) -C $$part .depend; done
 
 include mpcommon.mak
 
@@ -395,6 +396,7 @@
 	for part in $(PARTS); do $(MAKE) -C $$part distclean; done
 	$(MAKE) -C TOOLS distclean
 	-rm -f configure.log config.mak config.h
+	rm -f $(foreach dir,$(DIRS),$(foreach suffix,/*.d, $(addsuffix $(suffix),$(dir))))
 
 strip:
 	strip -s $(ALL_PRG)
--- a/mpcommon.mak	Fri Apr 18 21:47:51 2008 +0000
+++ b/mpcommon.mak	Fri Apr 18 22:49:17 2008 +0000
@@ -25,17 +25,24 @@
 	rm -f *.o *.a *.ho *~
 
 distclean:: clean
-	rm -f .depend test test2
+	rm -f *.d .depend test test2
 
 .depend: $(SRCS_COMMON) $(SRCS_MPLAYER) $(SRCS_MENCODER)
 	$(MPDEPEND_CMD) > $@
 
+%.d: %.c
+	$(MPDEPEND_CMD) > $@
+
 %.ho: %.h
 	$(CC) $(CFLAGS) -Wno-unused -c -o $@ -x c $<
 
 ALLHEADERS = $(wildcard *.h)
 checkheaders: $(ALLHEADERS:.h=.ho)
 
--include .depend
+# Hack to keep .depend from being generated at the top level unnecessarily.
+ifndef DEPS
+DEPS = .depend
+endif
+-include $(DEPS)
 
 .PHONY: libs *clean dep depend