Required for the conditional libavresample dependency added by the
native opus decoder to libavcodec.
---
Dependencies could be declared in configure and written to config.mak
that would avoid the reverse DOSUBDIR handling in Makefile. They are
already required for the pkg-config files so we could get rid of some
duplication. It's a little non-obvious how that can be done.

duplicates due to dependencies (mostly avutil) should be filtered out
in common.mak.


 Makefile   | 9 ++++++++-
 common.mak | 6 ++++++
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index c34320b..5c73fc4 100644
--- a/Makefile
+++ b/Makefile
@@ -119,6 +119,11 @@ SUBDIR_VARS := CLEANFILES EXAMPLES FFLIBS HOSTPROGS 
TESTPROGS TOOLS      \
                ALTIVEC-OBJS MMX-OBJS YASM-OBJS                           \
                OBJS HOSTOBJS TESTOBJS
 
+define REVERSE
+$(if $(strip $(1)), \
+     $(call REVERSE, $(wordlist 2, $(words $(1)), $(1))) $(firstword $(1)))
+endef
+
 define RESET
 $(1) :=
 $(1)-yes :=
@@ -132,7 +137,9 @@ include $(SRC_PATH)/$(1)/Makefile
 include $(SRC_PATH)/library.mak
 endef
 
-$(foreach D,$(FFLIBS),$(eval $(call DOSUBDIR,lib$(D))))
+# FFLIBS have to be handled in reverse order so that the dependency
+# in $(LIB)_DEPS are populated
+$(foreach D,$(call REVERSE, $(FFLIBS)),$(eval $(call DOSUBDIR,lib$(D))))
 
 include $(SRC_PATH)/doc/Makefile
 
diff --git a/common.mak b/common.mak
index ade9376..bd035b3 100644
--- a/common.mak
+++ b/common.mak
@@ -11,6 +11,12 @@ OBJS      += $(OBJS-yes)
 FFLIBS    := $(FFLIBS-yes) $(FFLIBS)
 TESTPROGS += $(TESTPROGS-yes)
 
+# keep track of the FFLIBS dependencies
+$(NAME)_DEPS := $(FFLIBS)
+
+# FIXME: duplicates libraries
+FFLIBS := $(foreach lib,$(FFLIBS),$(lib) $($(lib)_DEPS))
+
 LDLIBS       = $(FFLIBS:%=%$(BUILDSUF))
 FFEXTRALIBS := $(LDLIBS:%=$(LD_LIB)) $(EXTRALIBS)
 
-- 
1.9.2

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to