changeset 859:889aa3ced0f3 libavformat

support for building dynamic libraries on Mac OS X based on a patch by Lina Pezzella <J4rg0n -- at -- gentoo -- dot -- org>
author diego
date Mon, 26 Sep 2005 10:05:13 +0000
parents 66cc656ea404
children 9a18db8b5ae2
files Makefile
diffstat 1 files changed, 11 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Fri Sep 23 00:25:41 2005 +0000
+++ b/Makefile	Mon Sep 26 10:05:13 2005 +0000
@@ -81,9 +81,11 @@
 
 LIB= $(LIBPREF)avformat$(LIBSUF)
 ifeq ($(BUILD_SHARED),yes)
-SLIB= $(SLIBPREF)avformat$(SLIBSUF)
-
-AVCLIBS+=-lavcodec$(BUILDSUF) -L../libavcodec
+SLIBNAME= $(SLIBPREF)avformat$(SLIBSUF)
+AVCLIBS+=-lavcodec$(BUILDSUF) -L../libavcodec -lavutil$(BUILDSUF) -L../libavutil
+ifeq ($(CONFIG_DARWIN),yes)
+SHFLAGS += -Wl,-install_name,$(libdir)/$(SLIBNAME),-current_version,$(SPPVERSION),-compatibility_version,$(SPPVERSION)
+endif
 ifeq ($(CONFIG_MP3LAME),yes)
 AVCLIBS+=-lmp3lame
 endif
@@ -91,14 +93,14 @@
 
 SRCS := $(OBJS:.o=.c) $(PPOBJS:.o=.cpp)
 
-all: $(LIB) $(SLIB)
+all: $(LIB) $(SLIBNAME)
 
 $(LIB): $(OBJS) $(PPOBJS)
 	rm -f $@
 	$(AR) rc $@ $(OBJS) $(PPOBJS)
 	$(RANLIB) $@
 
-$(SLIB): $(OBJS)
+$(SLIBNAME): $(OBJS)
 ifeq ($(CONFIG_WIN32),yes)
 	$(CC) $(SHFLAGS) -Wl,--output-def,$(@:.dll=.def) -o $@ $(OBJS) $(PPOBJS) $(AVCLIBS) $(EXTRALIBS)
 	-lib /machine:i386 /def:$(@:.dll=.def)
@@ -112,11 +114,11 @@
 ifeq ($(BUILD_SHARED),yes)
 install: all install-headers
 ifeq ($(CONFIG_WIN32),yes)
-	install $(INSTALLSTRIP) -m 755 $(SLIB) "$(prefix)"
+	install $(INSTALLSTRIP) -m 755 $(SLIBNAME) "$(prefix)"
 else
 	install -d $(libdir)
-	install $(INSTALLSTRIP) -m 755 $(SLIB) $(libdir)/libavformat-$(VERSION).so
-	ln -sf libavformat-$(VERSION).so $(libdir)/libavformat.so
+	install $(INSTALLSTRIP) -m 755 $(SLIBNAME) $(libdir)/$(SLIBPREF)avformat-$(VERSION)$(SLIBSUF)
+	ln -sf $(SLIBPREF)avformat-$(VERSION)$(SLIBSUF) $(libdir)/$(SLIBNAME)
 	$(LDCONFIG) || true
 endif
 else
@@ -143,7 +145,7 @@
 	g++ $(subst -Wall,,$(CFLAGS)) -c -o $@ $< 
 
 distclean clean: 
-	rm -f *.o *.d .depend *~ *.a *.so $(LIB)
+	rm -f *.o *.d .depend *~ *.a *$(SLIBSUF) $(LIB)
 
 #
 # include dependency files if they exist