2010-03-21 10:54:08 +01:00
|
|
|
# -*- makefile -*-
|
|
|
|
|
2010-04-01 09:41:25 +02:00
|
|
|
# The major version of the library interface. This will control the soname.
|
|
|
|
# As such, this number must be incremented for any incompatible change to
|
|
|
|
# the library interface, (such as the deletion of an API or a major
|
|
|
|
# semantic change that breaks formerly functioning code).
|
2010-04-06 00:00:37 +02:00
|
|
|
#
|
|
|
|
# Note: We don't currently have plans to increment this at this time.
|
|
|
|
# If we *do* want to make an incompatible change to the library
|
|
|
|
# interface, we'll have to decide whether to increment this (creating
|
|
|
|
# a new soname) or to introduce symbol versioning to be able to
|
|
|
|
# provide support for both old and new interfaces without having to
|
|
|
|
# increment this.
|
2010-04-01 09:41:25 +02:00
|
|
|
LIBNOTMUCH_VERSION_MAJOR = 1
|
|
|
|
|
|
|
|
# The minor version of the library interface. This should be incremented at
|
|
|
|
# the time of release for any additions to the library interface.
|
2010-11-02 00:13:44 +01:00
|
|
|
LIBNOTMUCH_VERSION_MINOR = 2
|
2010-04-01 09:41:25 +02:00
|
|
|
|
|
|
|
# The release version the library interface. This should be incremented at
|
|
|
|
# the time of release if there have been no changes to the interface, (but
|
|
|
|
# simply compatible changes to the implementation).
|
|
|
|
LIBNOTMUCH_VERSION_RELEASE = 0
|
|
|
|
|
2010-04-30 21:00:24 +02:00
|
|
|
ifeq ($(PLATFORM),MACOSX)
|
2010-04-12 01:44:53 +02:00
|
|
|
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)
|
2010-04-15 01:18:19 +02:00
|
|
|
LIBRARY_LINK_FLAG = -dynamiclib -install_name $(SONAME) -compatibility_version $(LIBNOTMUCH_VERSION_MAJOR).$(LIBNOTMUCH_VERSION_MINOR) -current_version $(LIBNOTMUCH_VERSION_MAJOR).$(LIBNOTMUCH_VERSION_MINOR).$(LIBNOTMUCH_VERSION_RELEASE)
|
2010-04-12 01:44:53 +02:00
|
|
|
else
|
|
|
|
LIBRARY_SUFFIX = so
|
|
|
|
LINKER_NAME = libnotmuch.$(LIBRARY_SUFFIX)
|
2010-04-01 09:41:25 +02:00
|
|
|
SONAME = $(LINKER_NAME).$(LIBNOTMUCH_VERSION_MAJOR)
|
|
|
|
LIBNAME = $(SONAME).$(LIBNOTMUCH_VERSION_MINOR).$(LIBNOTMUCH_VERSION_RELEASE)
|
2010-04-15 01:16:05 +02:00
|
|
|
LIBRARY_LINK_FLAG = -shared -Wl,-soname=$(SONAME)
|
2010-06-05 01:52:56 +02:00
|
|
|
ifeq ($(LIBDIR_IN_LDCONFIG),1)
|
2010-06-16 16:14:18 +02:00
|
|
|
ifeq ($(DESTDIR),)
|
2010-06-05 01:52:56 +02:00
|
|
|
LIBRARY_INSTALL_POST_COMMAND=ldconfig
|
|
|
|
endif
|
2010-04-12 01:44:53 +02:00
|
|
|
endif
|
2010-06-16 16:14:18 +02:00
|
|
|
endif
|
2010-04-01 07:47:12 +02:00
|
|
|
|
2010-03-10 19:59:57 +01:00
|
|
|
dir := lib
|
2010-03-12 14:47:34 +01:00
|
|
|
extra_cflags += -I$(dir) -fPIC
|
2009-11-10 16:14:49 +01:00
|
|
|
|
2009-11-10 17:04:54 +01:00
|
|
|
libnotmuch_c_srcs = \
|
2010-04-15 01:03:18 +02:00
|
|
|
$(notmuch_compat_srcs) \
|
2010-11-11 08:26:31 +01:00
|
|
|
$(dir)/filenames.c \
|
2009-11-10 17:04:54 +01:00
|
|
|
$(dir)/libsha1.c \
|
|
|
|
$(dir)/message-file.c \
|
2009-11-15 08:05:17 +01:00
|
|
|
$(dir)/messages.c \
|
2009-11-10 17:04:54 +01:00
|
|
|
$(dir)/sha1.c \
|
|
|
|
$(dir)/tags.c \
|
|
|
|
$(dir)/xutil.c
|
2009-11-10 16:14:49 +01:00
|
|
|
|
2009-11-10 17:04:54 +01:00
|
|
|
libnotmuch_cxx_srcs = \
|
|
|
|
$(dir)/database.cc \
|
2010-01-05 22:29:23 +01:00
|
|
|
$(dir)/directory.cc \
|
2009-11-10 17:04:54 +01:00
|
|
|
$(dir)/index.cc \
|
|
|
|
$(dir)/message.cc \
|
|
|
|
$(dir)/query.cc \
|
|
|
|
$(dir)/thread.cc
|
|
|
|
|
|
|
|
libnotmuch_modules = $(libnotmuch_c_srcs:.c=.o) $(libnotmuch_cxx_srcs:.cc=.o)
|
2010-03-12 14:47:35 +01:00
|
|
|
|
2010-04-02 00:03:40 +02:00
|
|
|
$(dir)/libnotmuch.a: $(libnotmuch_modules)
|
|
|
|
$(call quiet,AR) rcs $@ $^
|
|
|
|
|
|
|
|
$(dir)/$(LIBNAME): $(libnotmuch_modules)
|
2010-04-15 01:16:05 +02:00
|
|
|
$(call quiet,CXX $(CXXFLAGS)) $^ $(FINAL_LIBNOTMUCH_LDFLAGS) $(LIBRARY_LINK_FLAG) -o $@
|
2010-03-12 14:47:35 +01:00
|
|
|
|
2010-04-01 09:41:25 +02:00
|
|
|
$(dir)/$(SONAME): $(dir)/$(LIBNAME)
|
2010-04-06 19:00:30 +02:00
|
|
|
ln -sf $(LIBNAME) $@
|
2010-04-01 09:41:25 +02:00
|
|
|
|
|
|
|
$(dir)/$(LINKER_NAME): $(dir)/$(SONAME)
|
2010-04-06 19:00:30 +02:00
|
|
|
ln -sf $(LIBNAME) $@
|
2009-11-10 16:14:49 +01:00
|
|
|
|
2010-04-01 07:47:12 +02:00
|
|
|
install: install-$(dir)
|
|
|
|
|
2010-09-21 18:09:01 +02:00
|
|
|
# The (often-reused) $dir works fine within targets/pre-requisites,
|
|
|
|
# but cannot be used reliably within commands, so copy its value to a
|
|
|
|
# variable that is not reused.
|
|
|
|
lib := $(dir)
|
2010-04-01 07:47:12 +02:00
|
|
|
install-$(dir):
|
2010-04-06 19:00:30 +02:00
|
|
|
mkdir -p $(DESTDIR)$(libdir)/
|
2010-09-21 18:09:01 +02:00
|
|
|
install -m0644 $(lib)/$(LIBNAME) $(DESTDIR)$(libdir)/
|
2010-04-06 19:00:30 +02:00
|
|
|
ln -sf $(LIBNAME) $(DESTDIR)$(libdir)/$(SONAME)
|
|
|
|
ln -sf $(LIBNAME) $(DESTDIR)$(libdir)/$(LINKER_NAME)
|
2010-04-06 21:41:54 +02:00
|
|
|
mkdir -p $(DESTDIR)$(includedir)
|
2010-09-21 18:09:01 +02:00
|
|
|
install -m0644 $(lib)/notmuch.h $(DESTDIR)$(includedir)/
|
2010-06-05 01:52:56 +02:00
|
|
|
$(LIBRARY_INSTALL_POST_COMMAND)
|
2010-04-01 07:47:12 +02:00
|
|
|
|
2009-11-10 17:04:54 +01:00
|
|
|
SRCS := $(SRCS) $(libnotmuch_c_srcs) $(libnotmuch_cxx_srcs)
|
2010-04-02 00:03:40 +02:00
|
|
|
CLEAN := $(CLEAN) $(libnotmuch_modules) $(dir)/$(SONAME) $(dir)/$(LINKER_NAME) $(dir)$(LIBNAME) libnotmuch.a
|