--- gsm-1.0-pl13/Makefile.orig	2006-04-26 23:14:26 +0400
+++ gsm-1.0-pl13/Makefile	2012-04-15 01:32:25 +0400
@@ -64,6 +64,7 @@
 # LDLIB	= -lgcc
 ######### Additional libraries needed by $(LD)
 
+EXEEXT = .exe
 
 # Where do you want to install libraries, binaries, a header file
 # and the manual pages?
@@ -71,7 +72,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	= $(DESTDIR)
 
 # Where do you want to install the gsm library, header file, and manpages?
 #
@@ -79,8 +80,9 @@
 # this directory.
 
 GSM_INSTALL_ROOT = $(INSTALL_ROOT)
+GSM_INSTALL_BIN = $(GSM_INSTALL_ROOT)/bin
 GSM_INSTALL_LIB = $(GSM_INSTALL_ROOT)/lib
-GSM_INSTALL_INC = $(GSM_INSTALL_ROOT)/inc
+GSM_INSTALL_INC = $(GSM_INSTALL_ROOT)/include
 GSM_INSTALL_MAN = $(GSM_INSTALL_ROOT)/man/man3
 
 
@@ -140,10 +142,11 @@
 # Targets
 
 LIBGSM	= $(LIB)/libgsm.a
+LIBGSM_DLL    = $(BIN)/libgsm.dll
 
-TOAST	= $(BIN)/toast
-UNTOAST	= $(BIN)/untoast
-TCAT	= $(BIN)/tcat
+TOAST	= $(BIN)/toast$(EXEEXT)
+UNTOAST	= $(BIN)/untoast$(EXEEXT)
+TCAT	= $(BIN)/tcat$(EXEEXT)
 
 # Headers
 
@@ -257,6 +260,8 @@
 # Install targets
 
 GSM_INSTALL_TARGETS =	\
+		$(GSM_INSTALL_BIN)/libgsm.dll		\
+		$(GSM_INSTALL_LIB)/libgsm.dll.a		\
 		$(GSM_INSTALL_LIB)/libgsm.a		\
 		$(GSM_INSTALL_INC)/gsm.h		\
 		$(GSM_INSTALL_MAN)/gsm.3		\
@@ -279,7 +283,7 @@
 
 # Target rules
 
-all:		$(LIBGSM) $(TOAST) $(TCAT) $(UNTOAST)
+all:		$(LIBGSM) $(LIBGSM_DLL) $(LIB)/libgsm.dll.a $(TOAST) $(TCAT) $(UNTOAST)
 		@-echo $(ROOT): Done.
 
 tst:		$(TST)/lin2cod $(TST)/cod2lin $(TOAST) $(TST)/test-result
@@ -304,6 +308,10 @@
 		$(AR) $(ARFLAGS) $(LIBGSM) $(GSM_OBJECTS)
 		$(RANLIB) $(LIBGSM)
 
+$(LIBGSM_DLL):	$(LIBGSM)
+		$(LD) $(LDFLAGS) $(LIBS) $(GSM_OBJECTS) -shared -o $(LIBGSM_DLL) -Wl,--out-implib=$(LIB)/libgsm.dll.a
+
+$(LIB)/libgsm.dll.a:	$(LIBGSM_DLL)
 
 # Toast, Untoast and Tcat -- the compress-like frontends to gsm.
 
@@ -397,6 +403,17 @@
 		-rm $@
 		cp $? $@
 		chmod 444 $@
+
+
+$(GSM_INSTALL_BIN)/libgsm.dll:	$(LIBGSM_DLL)
+		-rm $@
+		cp $? $@
+		chmod 664 $@
+
+$(GSM_INSTALL_LIB)/libgsm.dll.a: $(LIB)/libgsm.dll.a
+		-rm $@
+		cp $? $@
+		chmod 664 $@
 
 
 # Distribution
--- gsm-1.0-pl13/Makefile.orig	2012-04-15 01:36:38 +0400
+++ gsm-1.0-pl13/Makefile	2012-04-15 01:38:46 +0400
@@ -269,9 +269,9 @@
 		$(GSM_INSTALL_MAN)/gsm_print.3
 
 TOAST_INSTALL_TARGETS =	\
-		$(TOAST_INSTALL_BIN)/toast		\
-		$(TOAST_INSTALL_BIN)/tcat		\
-		$(TOAST_INSTALL_BIN)/untoast		\
+		$(TOAST_INSTALL_BIN)/toast$(EXEEXT)		\
+		$(TOAST_INSTALL_BIN)/tcat$(EXEEXT)		\
+		$(TOAST_INSTALL_BIN)/untoast$(EXEEXT)		\
 		$(TOAST_INSTALL_MAN)/toast.1
 
 
@@ -356,16 +356,16 @@
 			rm $(RMFLAGS) $(TOAST_INSTALL_TARGETS);	\
 		fi
 
-$(TOAST_INSTALL_BIN)/toast:	$(TOAST)
+$(TOAST_INSTALL_BIN)/toast$(EXEEXT):	$(TOAST)
 		-rm $@
 		cp $(TOAST) $@
 		chmod 755 $@
 
-$(TOAST_INSTALL_BIN)/untoast:	$(TOAST_INSTALL_BIN)/toast
+$(TOAST_INSTALL_BIN)/untoast$(EXEEXT):	$(TOAST_INSTALL_BIN)/toast$(EXEEXT)
 		-rm $@
 		ln $? $@
 
-$(TOAST_INSTALL_BIN)/tcat:	$(TOAST_INSTALL_BIN)/toast
+$(TOAST_INSTALL_BIN)/tcat$(EXEEXT):	$(TOAST_INSTALL_BIN)/toast$(EXEEXT)
 		-rm $@
 		ln $? $@
 
--- gsm-1.0-pl13/Makefile.orig	2012-04-15 01:39:20 +0400
+++ gsm-1.0-pl13/Makefile	2012-04-15 01:40:06 +0400
@@ -83,7 +83,7 @@
 GSM_INSTALL_BIN = $(GSM_INSTALL_ROOT)/bin
 GSM_INSTALL_LIB = $(GSM_INSTALL_ROOT)/lib
 GSM_INSTALL_INC = $(GSM_INSTALL_ROOT)/include
-GSM_INSTALL_MAN = $(GSM_INSTALL_ROOT)/man/man3
+GSM_INSTALL_MAN = $(GSM_INSTALL_ROOT)/share/man/man3
 
 
 # Where do you want to install the toast binaries and their manpage?
@@ -93,7 +93,7 @@
 
 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
 
