shared library support (.so) This patch adds support for building shared libraries when configured with the --enable-shared switch. Building DLLs would require more invasive changes to the sample utilities than I want to make in this patch, since on Windows you can't use the address of an imported symbol in a static initializer. The best way to work around this is proably to build the codec interface mapping table with an init() function, but dll support is of questionable value anyway, since most windows users will probably use a media framework lib like webmdshow, which links this library in staticly. Change-Id: Iafb48900549b0c6b67f4a05d3b790b2643d026f4
diff --git a/build/make/Makefile b/build/make/Makefile index 6dd1279..ba2578e 100755 --- a/build/make/Makefile +++ b/build/make/Makefile
@@ -220,6 +220,20 @@ $(qexec)$$(AR) $$(ARFLAGS) $$@ $$? endef +define so_template +# Not using a pattern rule here because we don't want to generate empty +# archives when they are listed as a dependency in files not responsible +# for creating them. +# +# This needs further abstraction for dealing with non-GNU linkers. +$(1): + $(if $(quiet),@echo " [LD] $$@") + $(qexec)$$(LD) -shared $$(LDFLAGS) \ + -Wl,--no-undefined -Wl,-soname,$$(SONAME) \ + -Wl,--version-script,$$(SO_VERSION_SCRIPT) -o $$@ \ + $$(filter %.o,$$?) +endef + define lipo_lib_template $(1): $(addsuffix /$(1),$(FAT_ARCHS)) $(if $(quiet),@echo " [LIPO] $$@") @@ -283,6 +297,7 @@ .libs: $(LIBS) @touch $@ $(foreach lib,$(filter %_g.a,$(LIBS)),$(eval $(call archive_template,$(lib)))) +$(foreach lib,$(filter %so.$(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_PATCH),$(LIBS)),$(eval $(call so_template,$(lib)))) INSTALL-LIBS=$(call cond_enabled,CONFIG_INSTALL_LIBS,INSTALL-LIBS) ifeq ($(MAKECMDGOALS),dist)