aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/Makefile.local
diff options
context:
space:
mode:
authorGravatar Aaron Ecay <aaronecay@gmail.com>2010-04-11 19:44:53 -0400
committerGravatar Carl Worth <cworth@cworth.org>2010-04-14 16:10:27 -0700
commit8c8079a8b14fac5e8ca6b682e5c76e08a824f2e7 (patch)
tree3458c569765850caeeebc8f7182806008095748e /lib/Makefile.local
parentf20640835823f28908005ef9d5dbc90c8a479f62 (diff)
Add infrastructure for building shared library on OS X.
This patch adds a configure check for OS X (actually Darwin), and sets up the Makefiles to build a proper shared library on that platform. Signed-off-by: Aaron Ecay <aaronecay@gmail.com>
Diffstat (limited to 'lib/Makefile.local')
-rw-r--r--lib/Makefile.local15
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/Makefile.local b/lib/Makefile.local
index dc608ef0..f001e75b 100644
--- a/lib/Makefile.local
+++ b/lib/Makefile.local
@@ -22,9 +22,20 @@ LIBNOTMUCH_VERSION_MINOR = 0
# simply compatible changes to the implementation).
LIBNOTMUCH_VERSION_RELEASE = 0
-LINKER_NAME = libnotmuch.so
+ifeq ($(MAC_OS_X),1)
+LIBRARY_SUFFIX = dylib
+# On OS X, library version numbers go before suffix.
+LINKER_NAME = libnotmuch.$(LIBRARY_SUFFIX)
+SONAME = libnotmuch.$(LIBNOTMUCH_VERSION_MAJOR).$(LIBRARY_SUFFIX)
+LIBNAME = libnotmuch.$(LIBNOTMUCH_VERSION_MAJOR).$(LIBNOTMUCH_VERSION_MINOR).$(LIBNOTMUCH_VERSION_RELEASE).$(LIBRARY_SUFFIX)
+LIBRARY_LINK_FLAG = -Wl,-dylib_install_name -Wl,$(SONAME)
+else
+LIBRARY_SUFFIX = so
+LINKER_NAME = libnotmuch.$(LIBRARY_SUFFIX)
SONAME = $(LINKER_NAME).$(LIBNOTMUCH_VERSION_MAJOR)
LIBNAME = $(SONAME).$(LIBNOTMUCH_VERSION_MINOR).$(LIBNOTMUCH_VERSION_RELEASE)
+LIBRARY_LINK_FLAG = -Wl,-soname=$(SONAME)
+endif
dir := lib
extra_cflags += -I$(dir) -fPIC
@@ -52,7 +63,7 @@ $(dir)/libnotmuch.a: $(libnotmuch_modules)
$(call quiet,AR) rcs $@ $^
$(dir)/$(LIBNAME): $(libnotmuch_modules)
- $(call quiet,CXX $(CXXFLAGS)) $^ $(FINAL_LIBNOTMUCH_LDFLAGS) -shared -Wl,-soname=$(SONAME) -o $@
+ $(call quiet,CXX $(CXXFLAGS)) $^ $(FINAL_LIBNOTMUCH_LDFLAGS) -shared $(LIBRARY_LINK_FLAG) -o $@
$(dir)/$(SONAME): $(dir)/$(LIBNAME)
ln -sf $(LIBNAME) $@