changeset 26403:c7c1cc069961

Sync with latest FFmpeg changes.
author diego
date Sun, 13 Apr 2008 10:54:33 +0000
parents 08117784bc9e
children d549dcb766df
files common.mak subdir.mak
diffstat 2 files changed, 25 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/common.mak	Sun Apr 13 10:44:21 2008 +0000
+++ b/common.mak	Sun Apr 13 10:54:33 2008 +0000
@@ -24,6 +24,15 @@
 %.ho: %.h
 	$(CC) $(CFLAGS) $(LIBOBJFLAGS) -Wno-unused -c -o $@ -x c $<
 
+%.d: %.c
+	$(DEPEND_CMD) > $@
+
+%.d: %.S
+	$(DEPEND_CMD) > $@
+
+%.d: %.cpp
+	$(DEPEND_CMD) > $@
+
 install: install-libs install-headers
 
 uninstall: uninstall-libs uninstall-headers
@@ -48,13 +57,17 @@
 OBJS  := $(addprefix $(SUBDIR),$(OBJS))
 TESTS := $(addprefix $(SUBDIR),$(TESTS))
 
+DEP_LIBS:=$(foreach NAME,$(FFLIBS),lib$(NAME)/$($(BUILD_SHARED:yes=S)LIBNAME))
+
 ALLHEADERS := $(subst $(SRC_DIR)/,$(SUBDIR),$(wildcard $(SRC_DIR)/*.h))
 checkheaders: $(filter-out %_template.ho,$(ALLHEADERS:.h=.ho))
 
-depend dep: $(SUBDIR).depend
+DEPS := $(OBJS:.o=.d)
+depend dep: $(DEPS)
 
-CLEANFILES += *.o *~ *.a *.lib *.so *.so.* *.dylib *.dll \
-              *.def *.dll.a *.exp *.ho *.map
+CLEANSUFFIXES = *.o *~ *.ho
+LIBSUFFIXES   = *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a *.exp *.map
+DISTCLEANSUFFIXES = *.d
 
 define RULES
 $(SUBDIR)%: $(SUBDIR)%.o $(LIBNAME)
@@ -63,18 +76,20 @@
 $(SUBDIR)%-test$(EXESUF): $(SUBDIR)%.c $(LIBNAME)
 	$(CC) $(CFLAGS) $(FFLDFLAGS) -DTEST -o $$@ $$^ $(FFEXTRALIBS)
 
-$(SUBDIR).depend: $(SRCS)
-	$(DEPEND_CMD) > $$@
-
 clean::
-	rm -f $(TESTS) $(addprefix $(SUBDIR),$(CLEANFILES))
+	rm -f $(TESTS) $(addprefix $(SUBDIR),$(CLEANFILES) $(CLEANSUFFIXES) $(LIBSUFFIXES)) \
+	    $(addprefix $(SUBDIR), $(foreach suffix,$(CLEANSUFFIXES),$(addsuffix /$(suffix),$(DIRS))))
 
 distclean:: clean
-	rm -f $(SUBDIR).depend
+	rm -f  $(addprefix $(SUBDIR),$(DISTCLEANSUFFIXES)) \
+            $(addprefix $(SUBDIR), $(foreach suffix,$(DISTCLEANSUFFIXES),$(addsuffix /$(suffix),$(DIRS))))
 endef
 
 $(eval $(RULES))
 
+# Clear DIRS variable so that it is not used in other subdirectories.
+DIRS =
+
 tests: $(TESTS)
 
--include $(SUBDIR).depend
+-include $(DEPS)
--- a/subdir.mak	Sun Apr 13 10:44:21 2008 +0000
+++ b/subdir.mak	Sun Apr 13 10:54:33 2008 +0000
@@ -33,8 +33,7 @@
 	$(SLIB_EXTRA_CMD)
 
 ifdef SUBDIR
-$(SUBDIR)$(SLIBNAME_WITH_MAJOR): \
-    $(foreach L,$(FFLIBS),lib$(L)/$(SLIBPREF)$(L)$(SLIBSUF))
+$(SUBDIR)$(SLIBNAME_WITH_MAJOR): $(DEP_LIBS)
 endif
 endif