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) -Wl,--no-undefined
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 \
59 libnotmuch_cxx_srcs = \
67 libnotmuch_modules := $(libnotmuch_c_srcs:.c=.o) $(libnotmuch_cxx_srcs:.cc=.o)
69 $(dir)/libnotmuch.a: $(libnotmuch_modules)
70 $(call quiet,AR) rcs $@ $^
72 $(dir)/$(LIBNAME): $(libnotmuch_modules) notmuch.sym
73 $(call quiet,CXX $(CXXFLAGS)) $(libnotmuch_modules) $(FINAL_LIBNOTMUCH_LDFLAGS) $(LIBRARY_LINK_FLAG) -o $@ util/libutil.a
75 notmuch.sym: $(srcdir)/$(dir)/notmuch.h $(libnotmuch_modules)
76 sh $(srcdir)/$(lib)/gen-version-script.sh $< $(libnotmuch_modules) > $@
78 $(dir)/$(SONAME): $(dir)/$(LIBNAME)
81 $(dir)/$(LINKER_NAME): $(dir)/$(SONAME)
84 install: install-$(dir)
86 install-$(dir): $(dir)/$(LIBNAME)
87 mkdir -p "$(DESTDIR)$(libdir)/"
88 install -m0644 "$(lib)/$(LIBNAME)" "$(DESTDIR)$(libdir)/"
89 ln -sf $(LIBNAME) "$(DESTDIR)$(libdir)/$(SONAME)"
90 ln -sf $(LIBNAME) "$(DESTDIR)$(libdir)/$(LINKER_NAME)"
91 mkdir -p "$(DESTDIR)$(includedir)"
92 install -m0644 "$(srcdir)/$(lib)/notmuch.h" "$(DESTDIR)$(includedir)/"
93 $(LIBRARY_INSTALL_POST_COMMAND)
95 SRCS := $(SRCS) $(libnotmuch_c_srcs) $(libnotmuch_cxx_srcs)
96 CLEAN += $(libnotmuch_modules) $(dir)/$(SONAME) $(dir)/$(LINKER_NAME)
97 CLEAN += $(dir)/$(LIBNAME) $(dir)/libnotmuch.a notmuch.sym
98 CLEAN += $(dir)/notmuch.h.gch