]> git.notmuchmail.org Git - notmuch/blob - lib/Makefile.local
Compile a static notmuch binary (but only install the shared version)
[notmuch] / lib / Makefile.local
1 # The major version of the library interface. This will control the soname.
2 # As such, this number must be incremented for any incompatible change to
3 # the library interface, (such as the deletion of an API or a major
4 # semantic change that breaks formerly functioning code).
5 LIBNOTMUCH_VERSION_MAJOR = 1
6
7 # The minor version of the library interface. This should be incremented at
8 # the time of release for any additions to the library interface.
9 LIBNOTMUCH_VERSION_MINOR = 0
10
11 # The release version the library interface. This should be incremented at
12 # the time of release if there have been no changes to the interface, (but
13 # simply compatible changes to the implementation).
14 LIBNOTMUCH_VERSION_RELEASE = 0
15
16 LINKER_NAME = libnotmuch.so
17 SONAME = $(LINKER_NAME).$(LIBNOTMUCH_VERSION_MAJOR)
18 LIBNAME = $(SONAME).$(LIBNOTMUCH_VERSION_MINOR).$(LIBNOTMUCH_VERSION_RELEASE)
19
20 dir := lib
21 extra_cflags += -I$(dir) -fPIC
22
23 libnotmuch_c_srcs =             \
24         $(dir)/libsha1.c        \
25         $(dir)/message-file.c   \
26         $(dir)/messages.c       \
27         $(dir)/sha1.c           \
28         $(dir)/tags.c           \
29         $(dir)/xutil.c
30
31 libnotmuch_cxx_srcs =           \
32         $(dir)/database.cc      \
33         $(dir)/directory.cc     \
34         $(dir)/index.cc         \
35         $(dir)/message.cc       \
36         $(dir)/query.cc         \
37         $(dir)/thread.cc
38
39 libnotmuch_modules = $(libnotmuch_c_srcs:.c=.o) $(libnotmuch_cxx_srcs:.cc=.o)
40
41 $(dir)/libnotmuch.a: $(libnotmuch_modules)
42         $(call quiet,AR) rcs $@ $^
43
44 $(dir)/$(LIBNAME): $(libnotmuch_modules)
45         $(call quiet,CXX,$(LDFLAGS)) $^ $(FINAL_LDFLAGS) -shared -Wl,-soname=$(SONAME) -o $@
46
47 $(dir)/$(SONAME): $(dir)/$(LIBNAME)
48         $(call quiet_symlink, $(LIBNAME) $@)
49
50 $(dir)/$(LINKER_NAME): $(dir)/$(SONAME)
51         $(call quiet_symlink, $(LIBNAME) $@)
52
53 install: install-$(dir)
54
55 install-$(dir):
56         $(call quiet_mkdir, $(DESTDIR)$(libdir)/)
57         $(call quiet_install_data, $(dir)/$(LIBNAME) $(DESTDIR)$(libdir)/)
58         $(call quiet_symlink, $(LIBNAME) $(DESTDIR)$(libdir)/$(SONAME))
59         $(call quiet_symlink, $(LIBNAME) $(DESTDIR)$(libdir)/$(LINKER_NAME))
60         $(call quiet_mkdir, $(DESTDIR)$(prefix)/include/)
61         $(call quiet_install_data, $(dir)/notmuch.h $(DESTDIR)$(prefix)/include/)
62
63 SRCS  := $(SRCS) $(libnotmuch_c_srcs) $(libnotmuch_cxx_srcs)
64 CLEAN := $(CLEAN) $(libnotmuch_modules) $(dir)/$(SONAME) $(dir)/$(LINKER_NAME) $(dir)$(LIBNAME) libnotmuch.a