Makefile: Fix library linking command for OS X

I'm not sure which system Aaron used, but on the machine I have access
to, (Darwin 8.11.0), the -shared and -dylib_install_name options are
not recognized. Instead I use -dynamic_lib and -install_name as
documented here:

http://www.finkproject.org/doc/porting/shared.php
This commit is contained in:
Carl Worth 2010-04-14 16:16:05 -07:00
parent 8c8079a8b1
commit 1036867897

View file

@ -28,13 +28,13 @@ LIBRARY_SUFFIX = dylib
LINKER_NAME = libnotmuch.$(LIBRARY_SUFFIX) LINKER_NAME = libnotmuch.$(LIBRARY_SUFFIX)
SONAME = libnotmuch.$(LIBNOTMUCH_VERSION_MAJOR).$(LIBRARY_SUFFIX) SONAME = libnotmuch.$(LIBNOTMUCH_VERSION_MAJOR).$(LIBRARY_SUFFIX)
LIBNAME = libnotmuch.$(LIBNOTMUCH_VERSION_MAJOR).$(LIBNOTMUCH_VERSION_MINOR).$(LIBNOTMUCH_VERSION_RELEASE).$(LIBRARY_SUFFIX) LIBNAME = libnotmuch.$(LIBNOTMUCH_VERSION_MAJOR).$(LIBNOTMUCH_VERSION_MINOR).$(LIBNOTMUCH_VERSION_RELEASE).$(LIBRARY_SUFFIX)
LIBRARY_LINK_FLAG = -Wl,-dylib_install_name -Wl,$(SONAME) LIBRARY_LINK_FLAG = -dynamiclib -install_name $(SONAME)
else else
LIBRARY_SUFFIX = so LIBRARY_SUFFIX = so
LINKER_NAME = libnotmuch.$(LIBRARY_SUFFIX) LINKER_NAME = libnotmuch.$(LIBRARY_SUFFIX)
SONAME = $(LINKER_NAME).$(LIBNOTMUCH_VERSION_MAJOR) SONAME = $(LINKER_NAME).$(LIBNOTMUCH_VERSION_MAJOR)
LIBNAME = $(SONAME).$(LIBNOTMUCH_VERSION_MINOR).$(LIBNOTMUCH_VERSION_RELEASE) LIBNAME = $(SONAME).$(LIBNOTMUCH_VERSION_MINOR).$(LIBNOTMUCH_VERSION_RELEASE)
LIBRARY_LINK_FLAG = -Wl,-soname=$(SONAME) LIBRARY_LINK_FLAG = -shared -Wl,-soname=$(SONAME)
endif endif
dir := lib dir := lib
@ -63,7 +63,7 @@ $(dir)/libnotmuch.a: $(libnotmuch_modules)
$(call quiet,AR) rcs $@ $^ $(call quiet,AR) rcs $@ $^
$(dir)/$(LIBNAME): $(libnotmuch_modules) $(dir)/$(LIBNAME): $(libnotmuch_modules)
$(call quiet,CXX $(CXXFLAGS)) $^ $(FINAL_LIBNOTMUCH_LDFLAGS) -shared $(LIBRARY_LINK_FLAG) -o $@ $(call quiet,CXX $(CXXFLAGS)) $^ $(FINAL_LIBNOTMUCH_LDFLAGS) $(LIBRARY_LINK_FLAG) -o $@
$(dir)/$(SONAME): $(dir)/$(LIBNAME) $(dir)/$(SONAME): $(dir)/$(LIBNAME)
ln -sf $(LIBNAME) $@ ln -sf $(LIBNAME) $@