1 # -*- makefile-gmake -*-
5 # The (often-reused) $dir works fine within targets/prerequisites,
6 # but cannot be used reliably within commands, so copy its value to a
7 # variable that is not reused.
10 ifeq ($(PLATFORM),MACOSX)
11 LIBRARY_SUFFIX = dylib
12 # On OS X, library version numbers go before suffix.
13 LINKER_NAME = libnotmuch.$(LIBRARY_SUFFIX)
14 SONAME = libnotmuch.$(LIBNOTMUCH_VERSION_MAJOR).$(LIBRARY_SUFFIX)
15 LIBNAME = libnotmuch.$(LIBNOTMUCH_VERSION_MAJOR).$(LIBNOTMUCH_VERSION_MINOR).$(LIBNOTMUCH_VERSION_RELEASE).$(LIBRARY_SUFFIX)
16 LIBRARY_LINK_FLAG = -dynamiclib -install_name $(libdir)/$(SONAME) -compatibility_version $(LIBNOTMUCH_VERSION_MAJOR).$(LIBNOTMUCH_VERSION_MINOR) -current_version $(LIBNOTMUCH_VERSION_MAJOR).$(LIBNOTMUCH_VERSION_MINOR).$(LIBNOTMUCH_VERSION_RELEASE)
19 LINKER_NAME = libnotmuch.$(LIBRARY_SUFFIX)
20 SONAME = $(LINKER_NAME).$(LIBNOTMUCH_VERSION_MAJOR)
21 LIBNAME = $(SONAME).$(LIBNOTMUCH_VERSION_MINOR).$(LIBNOTMUCH_VERSION_RELEASE)
22 LIBRARY_LINK_FLAG = -shared -Wl,--version-script=$(srcdir)/$(lib)/notmuch.sym,-soname=$(SONAME) $(NO_UNDEFINED_LDFLAGS)
23 ifeq ($(PLATFORM),OPENBSD)
24 LIBRARY_LINK_FLAG += -lc
26 ifeq ($(LIBDIR_IN_LDCONFIG),1)
28 LIBRARY_INSTALL_POST_COMMAND=ldconfig
33 extra_cflags += -I$(srcdir)/$(dir) -fPIC -fvisibility=hidden
34 extra_cxxflags += -fvisibility-inlines-hidden
37 $(notmuch_compat_srcs) \
39 $(dir)/string-list.c \
40 $(dir)/message-file.c \
49 libnotmuch_cxx_srcs = \
51 $(dir)/parse-time-vrp.cc \
55 $(dir)/add-message.cc \
56 $(dir)/message-property.cc \
60 $(dir)/regexp-fields.cc \
67 libnotmuch_modules := $(libnotmuch_c_srcs:.c=.o) $(libnotmuch_cxx_srcs:.cc=.o)
69 $(dir)/libnotmuch.a: $(libnotmuch_modules)
70 $(call quiet,AR) rcs $@ $^
72 $(dir)/$(LIBNAME): $(libnotmuch_modules) util/libnotmuch_util.a parse-time-string/libparse-time-string.a
73 $(call quiet,CXX $(CXXFLAGS)) $(libnotmuch_modules) $(FINAL_LIBNOTMUCH_LDFLAGS) $(LIBRARY_LINK_FLAG) -o $@ util/libnotmuch_util.a parse-time-string/libparse-time-string.a
75 $(dir)/$(SONAME): $(dir)/$(LIBNAME)
78 $(dir)/$(LINKER_NAME): $(dir)/$(SONAME)
81 install: install-$(dir)
83 install-$(dir): $(dir)/$(LIBNAME)
84 mkdir -p "$(DESTDIR)$(libdir)/"
85 install -m0644 "$(lib)/$(LIBNAME)" "$(DESTDIR)$(libdir)/"
86 ln -sf $(LIBNAME) "$(DESTDIR)$(libdir)/$(SONAME)"
87 ln -sf $(LIBNAME) "$(DESTDIR)$(libdir)/$(LINKER_NAME)"
88 mkdir -p "$(DESTDIR)$(includedir)"
89 install -m0644 "$(srcdir)/$(lib)/notmuch.h" "$(DESTDIR)$(includedir)/"
90 $(LIBRARY_INSTALL_POST_COMMAND)
92 SRCS := $(SRCS) $(libnotmuch_c_srcs) $(libnotmuch_cxx_srcs)
93 CLEAN += $(libnotmuch_modules) $(dir)/$(SONAME) $(dir)/$(LINKER_NAME)
94 CLEAN += $(dir)/$(LIBNAME) $(dir)/libnotmuch.a
95 CLEAN += $(dir)/notmuch.h.gch