--- Makefile.in.orig	2013-09-18 05:48:43.000000000 -0700
+++ Makefile.in	2016-08-10 17:16:10.000000000 -0700
@@ -3,7 +3,7 @@
 CFLAGS	= @CFLAGS@ -I. -DDEBUG -fPIC -fvisibility=hidden
 OBJS	= triostr.o trio.o trionan.o
 TARGETLIB	= libtrio.a
-TARGETSHLIB	= $(TARGETLIB:.a=.so.2.0.0)
+TARGETSHLIB	= $(TARGETLIB:.a=.1.dylib)
 TARGETINCS	= trio.h triop.h triodef.h trionan.h triostr.h
 LDFLAGS	= -L. -ltrio -lm
 AR	= ar
@@ -20,7 +20,7 @@
 # Installation settings
 INSTALL		= @INSTALL@
 INSTALL_DATA	= @INSTALL_DATA@
-prefix		= @prefix@
+prefix		= $(DESTDIR)@prefix@
 exec_prefix	= @exec_prefix@
 includedir	= @includedir@
 libdir		= @libdir@
@@ -47,6 +47,8 @@
 	$(MKDIR) $(libdir)
 	$(MKDIR) $(includedir)
 	$(INSTALL_DATA) $(TARGETLIB) $(TARGETSHLIB) $(libdir)/
+	ln -s $(TARGETSHLIB) $(libdir)/libtrio.dylib
+	ln -s $(TARGETSHLIB) $(libdir)/libtrio.__VERSION__.dylib
 	for i in $(TARGETINCS);do \
 	(set -x;$(INSTALL_DATA) $(srcdir)/$$i $(includedir)); \
 	done
@@ -68,7 +70,7 @@
 	$(RANLIB) $(TARGETLIB)
 
 $(TARGETSHLIB): $(TARGETLIB)
-	$(CC) -lm -shared -Wl,-soname,$(patsubst %.so.2.0.0,%.so.2,$@) -Wl,--whole-archive,$< -Wl,--no-whole-archive -o $@
+	$(CC) __LDFLAGS__ -dynamiclib -all_load -install_name $(prefix)/lib/$@ -compatibility_version 1 -current_version __VERSION__ -o $@ $<
 
 doc::
 	(cd $(srcdir) && $(GENDOC) doc/trio.cfg)
