]> git.notmuchmail.org Git - notmuch/blob - lib/Makefile.local
lib: add closure parameter to compact status update callback
[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 LIBNOTMUCH_VERSION_MAJOR = 3
9
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
13 #  be reset to 0).
14 LIBNOTMUCH_VERSION_MINOR = 0
15
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
20
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)
28 else
29 LIBRARY_SUFFIX = so
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
36 endif
37 ifeq ($(LIBDIR_IN_LDCONFIG),1)
38 ifeq ($(DESTDIR),)
39 LIBRARY_INSTALL_POST_COMMAND=ldconfig
40 endif
41 endif
42 endif
43
44 dir := lib
45 extra_cflags += -I$(srcdir)/$(dir) -fPIC
46
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.
50 lib := $(dir)
51
52 libnotmuch_c_srcs =             \
53         $(notmuch_compat_srcs)  \
54         $(dir)/filenames.c      \
55         $(dir)/string-list.c    \
56         $(dir)/libsha1.c        \
57         $(dir)/message-file.c   \
58         $(dir)/messages.c       \
59         $(dir)/sha1.c           \
60         $(dir)/tags.c
61
62 libnotmuch_cxx_srcs =           \
63         $(dir)/database.cc      \
64         $(dir)/parse-time-vrp.cc        \
65         $(dir)/directory.cc     \
66         $(dir)/index.cc         \
67         $(dir)/message.cc       \
68         $(dir)/query.cc         \
69         $(dir)/thread.cc
70
71 libnotmuch_modules := $(libnotmuch_c_srcs:.c=.o) $(libnotmuch_cxx_srcs:.cc=.o)
72
73 $(dir)/libnotmuch.a: $(libnotmuch_modules)
74         $(call quiet,AR) rcs $@ $^
75
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
78
79 notmuch.sym: $(srcdir)/$(dir)/notmuch.h $(libnotmuch_modules)
80         sh $(srcdir)/$(lib)/gen-version-script.sh $< $(libnotmuch_modules) > $@
81
82 $(dir)/$(SONAME): $(dir)/$(LIBNAME)
83         ln -sf $(LIBNAME) $@
84
85 $(dir)/$(LINKER_NAME): $(dir)/$(SONAME)
86         ln -sf $(LIBNAME) $@
87
88 install: install-$(dir)
89
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)
98
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