3 # The major version of the library interface. This will control the soname.
4 # As such, this number must be incremented for any incompatible change to
5 # the library interface, (such as the deletion of an API or a major
6 # semantic change that breaks formerly functioning code).
8 LIBNOTMUCH_VERSION_MAJOR = 2
10 # The minor version of the library interface. This should be incremented at
11 # the time of release for any additions to the library interface,
12 # (and when it is incremented, the release version of the library should
14 LIBNOTMUCH_VERSION_MINOR = 0
16 # The release version the library interface. This should be incremented at
17 # the time of release if there have been no changes to the interface, (but
18 # simply compatible changes to the implementation).
19 LIBNOTMUCH_VERSION_RELEASE = 0
21 ifeq ($(PLATFORM),MACOSX)
22 LIBRARY_SUFFIX = dylib
23 # On OS X, library version numbers go before suffix.
24 LINKER_NAME = libnotmuch.$(LIBRARY_SUFFIX)
25 SONAME = libnotmuch.$(LIBNOTMUCH_VERSION_MAJOR).$(LIBRARY_SUFFIX)
26 LIBNAME = libnotmuch.$(LIBNOTMUCH_VERSION_MAJOR).$(LIBNOTMUCH_VERSION_MINOR).$(LIBNOTMUCH_VERSION_RELEASE).$(LIBRARY_SUFFIX)
27 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)
30 LINKER_NAME = libnotmuch.$(LIBRARY_SUFFIX)
31 SONAME = $(LINKER_NAME).$(LIBNOTMUCH_VERSION_MAJOR)
32 LIBNAME = $(SONAME).$(LIBNOTMUCH_VERSION_MINOR).$(LIBNOTMUCH_VERSION_RELEASE)
33 LIBRARY_LINK_FLAG = -shared -Wl,--version-script=notmuch.sym,-soname=$(SONAME)
34 ifeq ($(LIBDIR_IN_LDCONFIG),1)
36 LIBRARY_INSTALL_POST_COMMAND=ldconfig
42 extra_cflags += -I$(srcdir)/$(dir) -fPIC
44 # The (often-reused) $dir works fine within targets/prerequisites,
45 # but cannot be used reliably within commands, so copy its value to a
46 # variable that is not reused.
50 $(notmuch_compat_srcs) \
52 $(dir)/string-list.c \
54 $(dir)/message-file.c \
60 libnotmuch_cxx_srcs = \
68 libnotmuch_modules := $(libnotmuch_c_srcs:.c=.o) $(libnotmuch_cxx_srcs:.cc=.o)
70 $(dir)/libnotmuch.a: $(libnotmuch_modules)
71 $(call quiet,AR) rcs $@ $^
73 $(dir)/$(LIBNAME): $(libnotmuch_modules) notmuch.sym
74 $(call quiet,CXX $(CXXFLAGS)) $(libnotmuch_modules) $(FINAL_LIBNOTMUCH_LDFLAGS) $(LIBRARY_LINK_FLAG) -o $@
76 notmuch.sym: $(srcdir)/$(dir)/notmuch.h $(libnotmuch_modules)
77 sh $(srcdir)/$(lib)/gen-version-script.sh $< $(libnotmuch_modules) > $@
79 $(dir)/$(SONAME): $(dir)/$(LIBNAME)
82 $(dir)/$(LINKER_NAME): $(dir)/$(SONAME)
85 install: install-$(dir)
87 install-$(dir): $(dir)/$(LIBNAME)
88 mkdir -p "$(DESTDIR)$(libdir)/"
89 install -m0644 "$(lib)/$(LIBNAME)" "$(DESTDIR)$(libdir)/"
90 ln -sf $(LIBNAME) "$(DESTDIR)$(libdir)/$(SONAME)"
91 ln -sf $(LIBNAME) "$(DESTDIR)$(libdir)/$(LINKER_NAME)"
92 mkdir -p "$(DESTDIR)$(includedir)"
93 install -m0644 "$(srcdir)/$(lib)/notmuch.h" "$(DESTDIR)$(includedir)/"
94 $(LIBRARY_INSTALL_POST_COMMAND)
96 SRCS := $(SRCS) $(libnotmuch_c_srcs) $(libnotmuch_cxx_srcs)
97 CLEAN += $(libnotmuch_modules) $(dir)/$(SONAME) $(dir)/$(LINKER_NAME)
98 CLEAN += $(dir)/$(LIBNAME) $(dir)/libnotmuch.a notmuch.sym
99 CLEAN += $(dir)/notmuch.h.gch