--- ./Makefile	2023-11-11 06:19:26
+++ ./Makefile	2023-11-11 06:24:44
@@ -71,7 +71,7 @@
 # Leave INSTALL_ROOT empty (or just don't execute "make install") to
 # not install gsm and toast outside of this directory.
 
-INSTALL_ROOT	=
+INSTALL_ROOT	?=
 
 # Where do you want to install the gsm library, header file, and manpages?
 #
@@ -80,8 +80,8 @@
 
 GSM_INSTALL_ROOT = $(INSTALL_ROOT)
 GSM_INSTALL_LIB = $(GSM_INSTALL_ROOT)/lib
-GSM_INSTALL_INC = $(GSM_INSTALL_ROOT)/inc
-GSM_INSTALL_MAN = $(GSM_INSTALL_ROOT)/man/man3
+GSM_INSTALL_INC = $(GSM_INSTALL_ROOT)/include
+GSM_INSTALL_MAN = $(GSM_INSTALL_ROOT)/share/man/man3
 
 
 # Where do you want to install the toast binaries and their manpage?
@@ -91,12 +91,12 @@
 
 TOAST_INSTALL_ROOT	  = $(INSTALL_ROOT)
 TOAST_INSTALL_BIN = $(TOAST_INSTALL_ROOT)/bin
-TOAST_INSTALL_MAN = $(TOAST_INSTALL_ROOT)/man/man1
+TOAST_INSTALL_MAN = $(TOAST_INSTALL_ROOT)/share/man/man1
 
 #  Other tools
 
 SHELL		= /bin/sh
-LN		= ln
+LN		= ln -s
 BASENAME 	= basename
 AR		= ar
 ARFLAGS		= cr
@@ -140,6 +140,7 @@
 # Targets
 
 LIBGSM	= $(LIB)/libgsm.a
+LIBGSMSO= $(LIB)/libgsm.@@VERSION@@.dylib
 
 TOAST	= $(BIN)/toast
 UNTOAST	= $(BIN)/untoast
@@ -279,7 +280,7 @@
 
 # Target rules
 
-all:		$(LIBGSM) $(TOAST) $(TCAT) $(UNTOAST)
+all:		$(LIBGSM) $(LIBGSMSO) $(TOAST) $(TCAT) $(UNTOAST)
 		@-echo $(ROOT): Done.
 
 tst:		$(TST)/lin2cod $(TST)/cod2lin $(TOAST) $(TST)/test-result
@@ -299,24 +300,30 @@
 
 # The basic API: libgsm
 
+$(LIBGSMSO):	$(LIB) $(GSM_OBJECTS)
+		$(LD) -o $(LIBGSMSO) -dynamiclib -Wl,-compatibility_version,1,-current_version,@@VERSION@@,-install_name,$(LIBGSMSO) $(GSM_OBJECTS) -lc
+		ln -fs libgsm.@@VERSION@@.dylib lib/libgsm.1.dylib
+		ln -fs libgsm.@@VERSION@@.dylib lib/libgsm.dylib
+
 $(LIBGSM):	$(LIB) $(GSM_OBJECTS)
 		-rm $(RMFLAGS) $(LIBGSM)
 		$(AR) $(ARFLAGS) $(LIBGSM) $(GSM_OBJECTS)
 		$(RANLIB) $(LIBGSM)
 
 
+
 # Toast, Untoast and Tcat -- the compress-like frontends to gsm.
 
 $(TOAST):	$(BIN) $(TOAST_OBJECTS) $(LIBGSM)
-		$(LD) $(LFLAGS) -o $(TOAST) $(TOAST_OBJECTS) $(LIBGSM) $(LDLIB)
+		$(LD) $(LFLAGS) -o $(TOAST) $(TOAST_OBJECTS) $(LIBGSM) $(LIBGSMO) $(LDLIB)
 
 $(UNTOAST):	$(BIN) $(TOAST)
 		-rm $(RMFLAGS) $(UNTOAST)
-		$(LN) $(TOAST) $(UNTOAST)
+		$(LN) toast $(UNTOAST)
 
 $(TCAT):	$(BIN) $(TOAST)
 		-rm $(RMFLAGS) $(TCAT)
-		$(LN) $(TOAST) $(TCAT)
+		$(LN) toast $(TCAT)
 
 
 # The local bin and lib directories
@@ -426,7 +433,9 @@
 
 clean:	semi-clean
 		-rm $(RMFLAGS) $(LIBGSM) $(ADDTST)/add		\
-			$(TOAST) $(TCAT) $(UNTOAST)	\
+			$(LIBGSMSO) $(LIB)/libgsm.1.dylib	\
+			$(LIB)/libgsm.dylib			\
+			$(TOAST) $(TCAT) $(UNTOAST)		\
 			$(ROOT)/gsm-1.0.tar.gz
 
 
