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
|
|
|
#
|
2011-10-04 18:47:04 +02:00
|
|
|
LIBNOTMUCH_VERSION_MAJOR = 2
|
2010-04-01 09:41:25 +02:00
|
|
|
|
|
|
|
# The minor version of the library interface. This should be incremented at
|
2010-11-12 05:42:45 +01:00
|
|
|
# the time of release for any additions to the library interface,
|
|
|
|
# (and when it is incremented, the release version of the library should
|
|
|
|
# be reset to 0).
|
2011-10-04 18:47:04 +02:00
|
|
|
LIBNOTMUCH_VERSION_MINOR = 0
|
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)
|
2011-06-22 02:25:06 +02:00
|
|
|
LIBRARY_LINK_FLAG = -shared -Wl,--version-script=notmuch.sym,-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
|
2011-03-10 00:02:42 +01:00
|
|
|
extra_cflags += -I$(srcdir)/$(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 \
|
2010-12-09 01:26:05 +01:00
|
|
|
$(dir)/string-list.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
|
|
|
|
|
2011-06-22 02:25:06 +02:00
|
|
|
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 $@ $^
|
|
|
|
|
2011-06-22 02:25:06 +02:00
|
|
|
$(dir)/$(LIBNAME): $(libnotmuch_modules) notmuch.sym
|
|
|
|
$(call quiet,CXX $(CXXFLAGS)) $(libnotmuch_modules) $(FINAL_LIBNOTMUCH_LDFLAGS) $(LIBRARY_LINK_FLAG) -o $@
|
|
|
|
|
2011-07-21 01:31:37 +02:00
|
|
|
notmuch.sym: lib/notmuch.h $(libnotmuch_modules)
|
2011-07-16 20:59:44 +02:00
|
|
|
sh lib/gen-version-script.sh $< $(libnotmuch_modules) > $@
|
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)
|
|
|
|
|
2011-06-20 22:14:21 +02:00
|
|
|
# The (often-reused) $dir works fine within targets/prerequisites,
|
2010-09-21 18:09:01 +02:00
|
|
|
# but cannot be used reliably within commands, so copy its value to a
|
|
|
|
# variable that is not reused.
|
|
|
|
lib := $(dir)
|
2011-03-10 00:02:42 +01:00
|
|
|
install-$(dir): $(dir)/$(LIBNAME)
|
2011-01-26 14:29:15 +01:00
|
|
|
mkdir -p "$(DESTDIR)$(libdir)/"
|
|
|
|
install -m0644 "$(lib)/$(LIBNAME)" "$(DESTDIR)$(libdir)/"
|
|
|
|
ln -sf $(LIBNAME) "$(DESTDIR)$(libdir)/$(SONAME)"
|
|
|
|
ln -sf $(LIBNAME) "$(DESTDIR)$(libdir)/$(LINKER_NAME)"
|
|
|
|
mkdir -p "$(DESTDIR)$(includedir)"
|
2011-03-10 00:02:42 +01:00
|
|
|
install -m0644 "$(srcdir)/$(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)
|
2011-06-25 14:45:58 +02:00
|
|
|
CLEAN += $(libnotmuch_modules) $(dir)/$(SONAME) $(dir)/$(LINKER_NAME)
|
2011-06-27 03:08:52 +02:00
|
|
|
CLEAN += $(dir)/$(LIBNAME) $(dir)/libnotmuch.a notmuch.sym
|
2011-06-25 14:45:58 +02:00
|
|
|
CLEAN += $(dir)/notmuch.h.gch
|