[notmuch] [PATCH] Build and link against notmuch shared library

Ben Gamari bgamari.foss at gmail.com
Wed Jan 20 12:07:27 PST 2010


---
 Makefile.local     |    5 +++--
 lib/Makefile.local |    8 ++++----
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/Makefile.local b/Makefile.local
index 933ff4c..6e851e4 100644
--- a/Makefile.local
+++ b/Makefile.local
@@ -21,8 +21,8 @@ notmuch_client_srcs =		\
 	show-message.c
 
 notmuch_client_modules = $(notmuch_client_srcs:.c=.o)
-notmuch: $(notmuch_client_modules) lib/notmuch.a
-	$(call quiet,CXX,$(LDFLAGS)) $^ $(FINAL_LDFLAGS) -o $@
+notmuch: $(notmuch_client_modules)
+	$(call quiet,CXX,$(LDFLAGS)) -lnotmuch $^ $(FINAL_LDFLAGS) -o $@
 
 notmuch.1.gz: notmuch.1
 	$(call quiet,gzip) --stdout $^ > $@
@@ -33,6 +33,7 @@ install: all notmuch.1.gz
 		install -d $$d ; \
 	done ;
 	install notmuch $(DESTDIR)$(prefix)/bin/
+	install lib/libnotmuch.so $(DESTDIR)$(prefix)/lib/
 	install -m0644 notmuch.1.gz $(DESTDIR)$(prefix)/share/man/man1/
 
 install-emacs: install emacs
diff --git a/lib/Makefile.local b/lib/Makefile.local
index 70489e1..5e5a6e6 100644
--- a/lib/Makefile.local
+++ b/lib/Makefile.local
@@ -1,5 +1,5 @@
 dir=lib
-extra_cflags += -I$(dir)
+extra_cflags += -I$(dir) -fPIC
 
 libnotmuch_c_srcs =		\
 	$(dir)/libsha1.c	\
@@ -18,8 +18,8 @@ libnotmuch_cxx_srcs =		\
 	$(dir)/thread.cc
 
 libnotmuch_modules = $(libnotmuch_c_srcs:.c=.o) $(libnotmuch_cxx_srcs:.cc=.o)
-$(dir)/notmuch.a: $(libnotmuch_modules)
-	$(call quiet,AR) rcs $@ $^
+$(dir)/libnotmuch.so: $(libnotmuch_modules)
+	$(call quiet,CXX,$(LDFLAGS)) $^ $(FINAL_LDFLAGS) -shared -o $@
 
 SRCS  := $(SRCS) $(libnotmuch_c_srcs) $(libnotmuch_cxx_srcs)
-CLEAN := $(CLEAN) $(libnotmuch_modules) $(dir)/notmuch.a
+CLEAN := $(CLEAN) $(libnotmuch_modules) $(dir)/notmuch.so
-- 
1.6.3.3



More information about the notmuch mailing list