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 = 3
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 ($(PLATFORM),OPENBSD)
35 LIBRARY_LINK_FLAG += -lc
37 ifeq ($(LIBDIR_IN_LDCONFIG),1)
39 LIBRARY_INSTALL_POST_COMMAND=ldconfig
45 extra_cflags += -I$(srcdir)/$(dir) -fPIC
47 # The (often-reused) $dir works fine within targets/prerequisites,
48 # but cannot be used reliably within commands, so copy its value to a
49 # variable that is not reused.
53 $(notmuch_compat_srcs) \
55 $(dir)/string-list.c \
57 $(dir)/message-file.c \
62 libnotmuch_cxx_srcs = \
64 $(dir)/parse-time-vrp.cc \
71 libnotmuch_modules := $(libnotmuch_c_srcs:.c=.o) $(libnotmuch_cxx_srcs:.cc=.o)
73 $(dir)/libnotmuch.a: $(libnotmuch_modules)
74 $(call quiet,AR) rcs $@ $^
76 $(dir)/$(LIBNAME): $(libnotmuch_modules) notmuch.sym util/libutil.a parse-time-string/libparse-time-string.a
77 $(call quiet,CXX $(CXXFLAGS)) $(libnotmuch_modules) $(FINAL_LIBNOTMUCH_LDFLAGS) $(LIBRARY_LINK_FLAG) -o $@ util/libutil.a parse-time-string/libparse-time-string.a
79 notmuch.sym: $(srcdir)/$(dir)/notmuch.h $(libnotmuch_modules)
80 sh $(srcdir)/$(lib)/gen-version-script.sh $< $(libnotmuch_modules) > $@
82 $(dir)/$(SONAME): $(dir)/$(LIBNAME)
85 $(dir)/$(LINKER_NAME): $(dir)/$(SONAME)
88 install: install-$(dir)
90 install-$(dir): $(dir)/$(LIBNAME)
91 mkdir -p "$(DESTDIR)$(libdir)/"
92 install -m0644 "$(lib)/$(LIBNAME)" "$(DESTDIR)$(libdir)/"
93 ln -sf $(LIBNAME) "$(DESTDIR)$(libdir)/$(SONAME)"
94 ln -sf $(LIBNAME) "$(DESTDIR)$(libdir)/$(LINKER_NAME)"
95 mkdir -p "$(DESTDIR)$(includedir)"
96 install -m0644 "$(srcdir)/$(lib)/notmuch.h" "$(DESTDIR)$(includedir)/"
97 $(LIBRARY_INSTALL_POST_COMMAND)
99 SRCS := $(SRCS) $(libnotmuch_c_srcs) $(libnotmuch_cxx_srcs)
100 CLEAN += $(libnotmuch_modules) $(dir)/$(SONAME) $(dir)/$(LINKER_NAME)
101 CLEAN += $(dir)/$(LIBNAME) $(dir)/libnotmuch.a notmuch.sym
102 CLEAN += $(dir)/notmuch.h.gch