Martin Storsjö <[email protected]> writes:
> On Tue, 9 Oct 2012, Måns Rullgård wrote:
>
>> Martin Storsjö <[email protected]> writes:
>>
>>> DEP_LIBS is part of $^, since DEP_LIBS is a dependency of the
>>> test tools. The libs, that originate in the FFLIBS variable,
>>> are added into FFEXTRALIBS already (normally in the form -lavutil),
>>> but via DEP_LIBS in the literal form as libavutil/libavutil.so.
>>>
>>> Previously, when building test tools, the make file invoked
>>> the linker with the parameters "libavutil/libavutil.so -lavutil".
>>> On linux this worked just fine.
>>>
>>> On mingw, the linker actually can handle being given both the literal
>>> DLL name or using the -lavutil parameter (and handle multiple copies
>>> of them), but when using both forms at the same time for the same
>>> library, the mingw linker trips up.
>>>
>>> On msvc, the linker can't handle being passed the literal DLL name
>>> at all.
>>>
>>> This fixes running fate on mingw with DLLs enabled.
>>> ---
>>> library.mak | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/library.mak b/library.mak
>>> index a68ab14..ca368a0 100644
>>> --- a/library.mak
>>> +++ b/library.mak
>>> @@ -36,7 +36,7 @@ install-libs-$(CONFIG_SHARED): install-lib$(NAME)-shared
>>>
>>> define RULES
>>> $(EXAMPLES) $(TESTPROGS) $(TOOLS): %$(EXESUF): %.o
>>> - $$(LD) $(LDFLAGS) $$(LD_O) $$^ $(FFEXTRALIBS) $$(ELIBS)
>>> + $$(LD) $(LDFLAGS) $$(LD_O) $$(filter-out $(DEP_LIBS), $$^)
>>> $(FFEXTRALIBS) $$(ELIBS)
>>
>> $$(filter %.o,$$^) seems simpler and possibly more robust. We already
>> use this for creating the actual shared libs.
>
> True, that sounds simpler. I think there's an issue with that though,
> for examples/tools, $^ includes $(THIS_LIB).
>
> That particular case also is an issue for MSVC, since $(THIS_LIB) is
> the literal DLL file name, while the linker needs to get the
> equivalent of -lfoo - that is, replacing $(THIS_LIB) with
> $(NAME:%=$(LD_LIB)) in the linker args.
This should work:
diff --git a/library.mak b/library.mak
index 48eb286..4593b11 100644
--- a/library.mak
+++ b/library.mak
@@ -35,8 +35,11 @@ install-libs-$(CONFIG_STATIC): install-lib$(NAME)-static
install-libs-$(CONFIG_SHARED): install-lib$(NAME)-shared
define RULES
+$(EXAMPLES) $(TOOLS): LIB = $(FULLNAME:%=$(LD_LIB))
+$(TESTPROGS): LIB = $(SUBDIR)$(LIBNAME)
+
$(EXAMPLES) $(TESTPROGS) $(TOOLS): %$(EXESUF): %.o
- $$(LD) $(LDFLAGS) $$(LD_O) $$^ $(FFEXTRALIBS) $$(ELIBS)
+ $$(LD) $(LDFLAGS) $$(LD_O) $$(filter %.o,$$^) $$(LIB) $(FFEXTRALIBS)
$$(ELIBS)
$(SUBDIR)$(SLIBNAME): $(SUBDIR)$(SLIBNAME_WITH_MAJOR)
$(Q)cd ./$(SUBDIR) && $(LN_S) $(SLIBNAME_WITH_MAJOR) $(SLIBNAME)
--
Måns Rullgård
[email protected]
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel