[Ffmpeg-devel] [PATCH] Changing the behaviour of make with default target

Alexander Strasser eclipse7
Sat Jul 30 22:03:05 CEST 2005


Hi,

  problems with linking the shared libs with m$ toolchain on
windows keep coming up again and again.

  Maybe I am wrong, as I didn't get feedback yet.
I for sure know it worked for me, as i had to use libav*
with m$ toolchain one time not so long ago.

  I think part of the problem is that when configured with
--enable-shared the static libs and the shared libs get
built when using make with default target.

  The problem on windows is that you use shared libs with an
import lib. So what happens normally is that the avcodec.lib
is built which is the just static lib and the dll and a def
file and, with proper environment setup including m$ lib.exe,
also the import lib is built (which is named avcodec.lib
and overwrites the static lib). But in case the environment
isn't setup properly (no lib.exe in path) the import
lib doens't get build and people seem to confuse it with
the static lib which doesn't work properly when used
with m$ tools. Despite the problem that most of them
most probably didn't want to use the static version but
the shared one.
  Make doesn't error out, because the rule is written to
silently ignore an error at that place. Maybe because it
assumes that many people don't use m$ tools, which would
make sense to me.

  So maybe it would be better to just build the shared
lib only by default when configured with --enable-shared.
  Then ppl would notice there is something missing.
  This is what the attached patch does.

  There is still the problem with filename clash tho, but
i don't think it will still be that problematic as it is
now. People knowing what they are doing will still be able
to build both libs.
  Also a different approach would be to print a big fat
warning for m$ devel tool users if the import lib could
not be generated.

  Comments welcome...
  
  Alex (beastd)
-------------- next part --------------
Index: libavformat/Makefile
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/Makefile,v
retrieving revision 1.95
diff -u -r1.95 Makefile
--- libavformat/Makefile	15 Jul 2005 12:50:00 -0000	1.95
+++ libavformat/Makefile	30 Jul 2005 17:59:50 -0000
@@ -89,7 +89,11 @@
 
 SRCS := $(OBJS:.o=.c) $(PPOBJS:.o=.cpp)
 
-all: $(LIB) $(SLIB)
+ifeq ($(BUILD_SHARED),yes)
+all: $(SLIB)
+else
+all: $(LIB)
+endif
 
 $(LIB): $(OBJS) $(PPOBJS)
 	rm -f $@
Index: libavcodec/Makefile
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/Makefile,v
retrieving revision 1.196
diff -u -r1.196 Makefile
--- libavcodec/Makefile	17 Jul 2005 00:28:11 -0000	1.196
+++ libavcodec/Makefile	30 Jul 2005 17:59:50 -0000
@@ -380,7 +380,11 @@
 endif
 TESTS= imgresample-test dct-test motion-test fft-test
 
-all: $(LIB) $(SLIB)
+ifeq ($(BUILD_SHARED),yes)
+all: $(SLIB)
+else
+all: $(LIB)
+endif
 
 amrlibs:
 	$(MAKE) -C amr spclib fipoplib



More information about the ffmpeg-devel mailing list