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 = 1
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 # Note: Don't forget to change the VERSION macros in notmuch.h when
22 # any of the above change.
24 ifeq ($(PLATFORM),MACOSX)
25 LIBRARY_SUFFIX = dylib
26 # On OS X, library version numbers go before suffix.
27 LINKER_NAME = libnotmuch.$(LIBRARY_SUFFIX)
28 SONAME = libnotmuch.$(LIBNOTMUCH_VERSION_MAJOR).$(LIBRARY_SUFFIX)
29 LIBNAME = libnotmuch.$(LIBNOTMUCH_VERSION_MAJOR).$(LIBNOTMUCH_VERSION_MINOR).$(LIBNOTMUCH_VERSION_RELEASE).$(LIBRARY_SUFFIX)
30 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)
33 LINKER_NAME = libnotmuch.$(LIBRARY_SUFFIX)
34 SONAME = $(LINKER_NAME).$(LIBNOTMUCH_VERSION_MAJOR)
35 LIBNAME = $(SONAME).$(LIBNOTMUCH_VERSION_MINOR).$(LIBNOTMUCH_VERSION_RELEASE)
36 LIBRARY_LINK_FLAG = -shared -Wl,--version-script=notmuch.sym,-soname=$(SONAME) -Wl,--no-undefined
37 ifeq ($(PLATFORM),OPENBSD)
38 LIBRARY_LINK_FLAG += -lc
40 ifeq ($(LIBDIR_IN_LDCONFIG),1)
42 LIBRARY_INSTALL_POST_COMMAND=ldconfig
48 extra_cflags += -I$(srcdir)/$(dir) -fPIC
50 # The (often-reused) $dir works fine within targets/prerequisites,
51 # but cannot be used reliably within commands, so copy its value to a
52 # variable that is not reused.
56 $(notmuch_compat_srcs) \
58 $(dir)/string-list.c \
60 $(dir)/message-file.c \
65 libnotmuch_cxx_srcs = \
67 $(dir)/parse-time-vrp.cc \
74 libnotmuch_modules := $(libnotmuch_c_srcs:.c=.o) $(libnotmuch_cxx_srcs:.cc=.o)
76 $(dir)/libnotmuch.a: $(libnotmuch_modules)
77 $(call quiet,AR) rcs $@ $^
79 $(dir)/$(LIBNAME): $(libnotmuch_modules) notmuch.sym util/libutil.a parse-time-string/libparse-time-string.a
80 $(call quiet,CXX $(CXXFLAGS)) $(libnotmuch_modules) $(FINAL_LIBNOTMUCH_LDFLAGS) $(LIBRARY_LINK_FLAG) -o $@ util/libutil.a parse-time-string/libparse-time-string.a
82 notmuch.sym: $(srcdir)/$(dir)/notmuch.h $(libnotmuch_modules)
83 sh $(srcdir)/$(lib)/gen-version-script.sh $< $(libnotmuch_modules) > $@
85 $(dir)/$(SONAME): $(dir)/$(LIBNAME)
88 $(dir)/$(LINKER_NAME): $(dir)/$(SONAME)
91 install: install-$(dir)
93 install-$(dir): $(dir)/$(LIBNAME)
94 mkdir -p "$(DESTDIR)$(libdir)/"
95 install -m0644 "$(lib)/$(LIBNAME)" "$(DESTDIR)$(libdir)/"
96 ln -sf $(LIBNAME) "$(DESTDIR)$(libdir)/$(SONAME)"
97 ln -sf $(LIBNAME) "$(DESTDIR)$(libdir)/$(LINKER_NAME)"
98 mkdir -p "$(DESTDIR)$(includedir)"
99 install -m0644 "$(srcdir)/$(lib)/notmuch.h" "$(DESTDIR)$(includedir)/"
100 $(LIBRARY_INSTALL_POST_COMMAND)
102 SRCS := $(SRCS) $(libnotmuch_c_srcs) $(libnotmuch_cxx_srcs)
103 CLEAN += $(libnotmuch_modules) $(dir)/$(SONAME) $(dir)/$(LINKER_NAME)
104 CLEAN += $(dir)/$(LIBNAME) $(dir)/libnotmuch.a notmuch.sym
105 CLEAN += $(dir)/notmuch.h.gch