]> git.notmuchmail.org Git - notmuch/blob - lib/Makefile.local
1eb1f4ea3b59ed8c21e56228cfb95f9195b42838
[notmuch] / lib / Makefile.local
1 # -*- makefile -*-
2
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).
7 #
8 # Note: We don't currently have plans to increment this at this time.
9 # If we *do* want to make an incompatible change to the library
10 # interface, we'll have to decide whether to increment this (creating
11 # a new soname) or to introduce symbol versioning to be able to
12 # provide support for both old and new interfaces without having to
13 # increment this.
14 LIBNOTMUCH_VERSION_MAJOR = 1
15
16 # The minor version of the library interface. This should be incremented at
17 # the time of release for any additions to the library interface.
18 LIBNOTMUCH_VERSION_MINOR = 0
19
20 # The release version the library interface. This should be incremented at
21 # the time of release if there have been no changes to the interface, (but
22 # simply compatible changes to the implementation).
23 LIBNOTMUCH_VERSION_RELEASE = 0
24
25 ifeq ($(MAC_OS_X),1)
26 LIBRARY_SUFFIX = dylib
27 # On OS X, library version numbers go before suffix.
28 LINKER_NAME = libnotmuch.$(LIBRARY_SUFFIX)
29 SONAME = libnotmuch.$(LIBNOTMUCH_VERSION_MAJOR).$(LIBRARY_SUFFIX)
30 LIBNAME = libnotmuch.$(LIBNOTMUCH_VERSION_MAJOR).$(LIBNOTMUCH_VERSION_MINOR).$(LIBNOTMUCH_VERSION_RELEASE).$(LIBRARY_SUFFIX)
31 LIBRARY_LINK_FLAG = -dynamiclib -install_name $(SONAME)
32 else
33 LIBRARY_SUFFIX = so
34 LINKER_NAME = libnotmuch.$(LIBRARY_SUFFIX)
35 SONAME = $(LINKER_NAME).$(LIBNOTMUCH_VERSION_MAJOR)
36 LIBNAME = $(SONAME).$(LIBNOTMUCH_VERSION_MINOR).$(LIBNOTMUCH_VERSION_RELEASE)
37 LIBRARY_LINK_FLAG = -shared -Wl,-soname=$(SONAME)
38 endif
39
40 dir := lib
41 extra_cflags += -I$(dir) -fPIC
42
43 libnotmuch_c_srcs =             \
44         $(notmuch_compat_srcs)  \
45         $(dir)/libsha1.c        \
46         $(dir)/message-file.c   \
47         $(dir)/messages.c       \
48         $(dir)/sha1.c           \
49         $(dir)/tags.c           \
50         $(dir)/xutil.c
51
52 libnotmuch_cxx_srcs =           \
53         $(dir)/database.cc      \
54         $(dir)/directory.cc     \
55         $(dir)/index.cc         \
56         $(dir)/message.cc       \
57         $(dir)/query.cc         \
58         $(dir)/thread.cc
59
60 libnotmuch_modules = $(libnotmuch_c_srcs:.c=.o) $(libnotmuch_cxx_srcs:.cc=.o)
61
62 $(dir)/libnotmuch.a: $(libnotmuch_modules)
63         $(call quiet,AR) rcs $@ $^
64
65 $(dir)/$(LIBNAME): $(libnotmuch_modules)
66         $(call quiet,CXX $(CXXFLAGS)) $^ $(FINAL_LIBNOTMUCH_LDFLAGS) $(LIBRARY_LINK_FLAG) -o $@
67
68 $(dir)/$(SONAME): $(dir)/$(LIBNAME)
69         ln -sf $(LIBNAME) $@
70
71 $(dir)/$(LINKER_NAME): $(dir)/$(SONAME)
72         ln -sf $(LIBNAME) $@
73
74 install: install-$(dir)
75
76 install-$(dir):
77         mkdir -p $(DESTDIR)$(libdir)/
78         install -m0644 $(dir)/$(LIBNAME) $(DESTDIR)$(libdir)/
79         ln -sf $(LIBNAME) $(DESTDIR)$(libdir)/$(SONAME)
80         ln -sf $(LIBNAME) $(DESTDIR)$(libdir)/$(LINKER_NAME)
81         mkdir -p $(DESTDIR)$(includedir)
82         install -m0644 $(dir)/notmuch.h $(DESTDIR)$(includedir)/
83
84 SRCS  := $(SRCS) $(libnotmuch_c_srcs) $(libnotmuch_cxx_srcs)
85 CLEAN := $(CLEAN) $(libnotmuch_modules) $(dir)/$(SONAME) $(dir)/$(LINKER_NAME) $(dir)$(LIBNAME) libnotmuch.a