-$(dir)/notmuch.a: $(libnotmuch_modules)
- $(call quiet,AR) rcs $@ $^
+
+$(dir)/$(SONAME) : $(libnotmuch_modules)
+ $(call quiet,CXX,$(LDFLAGS)) $^ $(FINAL_LDFLAGS) -shared -Wl,-soname=$(SONAME) -o $@
+
+$(dir)/libnotmuch.so: $(dir)/$(SONAME)
+ ln -fs $(SONAME) $@