summarylogtreecommitdiffstats
path: root/gsm-shared.patch
blob: c25b01f7fa0df685798a584fe897169a8fa9ee98 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
--- Makefile	2022-08-04 20:46:46.107815841 +0200
+++ Makefile	2022-08-08 17:22:23.799342237 +0200
@@ -65,6 +65,10 @@
 ######### Additional libraries needed by $(LD)
 
 
+# What is the version of this release (in standard dotted syntax)?
+DOTTED_VERSION = 1.0.22
+
+
 # Where do you want to install libraries, binaries, a header file
 # and the manual pages?
 #
@@ -96,7 +100,7 @@
 #  Other tools
 
 SHELL		= /bin/sh
-LN		= ln
+LN		= ln -s -f
 BASENAME 	= basename
 AR		= ar
 ARFLAGS		= cr
@@ -139,7 +143,7 @@
 
 # Targets
 
-LIBGSM	= $(LIB)/libgsm.a
+LIBGSMSO	= $(LIB)/libgsm.so
 
 TOAST	= $(BIN)/toast
 UNTOAST	= $(BIN)/untoast
@@ -257,7 +261,7 @@
 # Install targets
 
 GSM_INSTALL_TARGETS =	\
-		$(GSM_INSTALL_LIB)/libgsm.a		\
+		$(GSM_INSTALL_LIB)/libgsm.so		\
 		$(GSM_INSTALL_INC)/gsm.h		\
 		$(GSM_INSTALL_MAN)/gsm.3		\
 		$(GSM_INSTALL_MAN)/gsm_explode.3	\
@@ -279,7 +283,7 @@
 
 # Target rules
 
-all:		$(LIBGSM) $(TOAST) $(TCAT) $(UNTOAST)
+all:		$(LIBGSMSO) $(TOAST) $(TCAT) $(UNTOAST)
 		@-echo $(ROOT): Done.
 
 tst:		$(TST)/lin2cod $(TST)/cod2lin $(TOAST) $(TST)/test-result
@@ -299,16 +303,16 @@
 
 # The basic API: libgsm
 
-$(LIBGSM):	$(LIB) $(GSM_OBJECTS)
-		-rm $(RMFLAGS) $(LIBGSM)
-		$(AR) $(ARFLAGS) $(LIBGSM) $(GSM_OBJECTS)
-		$(RANLIB) $(LIBGSM)
+$(LIBGSMSO):	$(LIB) $(GSM_OBJECTS)
+		$(LD) -shared -Wl,-soname,libgsm.so.1 -o $@.$(DOTTED_VERSION) $(GSM_OBJECTS)
+		$(LN) `$(BASENAME) $@.$(DOTTED_VERSION)` $@.1
+		$(LN) `$(BASENAME) $@.$(DOTTED_VERSION)` $@
 
 
 # Toast, Untoast and Tcat -- the compress-like frontends to gsm.
 
-$(TOAST):	$(BIN) $(TOAST_OBJECTS) $(LIBGSM)
-		$(LD) $(LFLAGS) -o $(TOAST) $(TOAST_OBJECTS) $(LIBGSM) $(LDLIB)
+$(TOAST):	$(BIN) $(TOAST_OBJECTS) $(LIBGSMSO)
+		$(LD) $(LFLAGS) -o $(TOAST) $(TOAST_OBJECTS) $(LIBGSMSO) $(LDLIB)
 
 $(UNTOAST):	$(BIN) $(TOAST)
 		-rm $(RMFLAGS) $(UNTOAST)
@@ -393,10 +397,12 @@
 		cp $? $@
 		chmod 444 $@
 
-$(GSM_INSTALL_LIB)/libgsm.a:	$(LIBGSM)
-		-rm $(RMFLAGS) $@
-		cp $? $@
-		chmod 444 $@
+$(GSM_INSTALL_LIB)/libgsm.so:	$(LIBGSMSO)
+		-rm $(RMFLAGS) $@ $@.1 $@.$(DOTTED_VERSION)
+		cp $?.$(DOTTED_VERSION) $@.$(DOTTED_VERSION)
+		chmod 755 $@.$(DOTTED_VERSION)
+		$(LN) libgsm.so.$(DOTTED_VERSION) $@
+		$(LN) libgsm.so.$(DOTTED_VERSION) $@.1
 
 
 # Distribution
@@ -425,7 +431,7 @@
 			-print | xargs rm $(RMFLAGS)
 
 clean:	semi-clean
-		-rm $(RMFLAGS) $(LIBGSM) $(ADDTST)/add		\
+		-rm $(RMFLAGS) $(LIBGSMSO)* $(ADDTST)/add		\
 			$(TOAST) $(TCAT) $(UNTOAST)	\
 			$(ROOT)/gsm-1.0.tar.gz
 
@@ -473,22 +479,22 @@
 $(TST)/test-result:	$(TST)/lin2cod $(TST)/cod2lin $(TOAST) $(TST)/run
 			( cd $(TST); ./run ) 
 
-$(TST)/lin2txt:		$(TST)/lin2txt.o $(LIBGSM)
+$(TST)/lin2txt:		$(TST)/lin2txt.o $(LIBGSMSO)
 			$(LD) $(LFLAGS) -o $(TST)/lin2txt \
-				$(TST)/lin2txt.o $(LIBGSM) $(LDLIB)
+				$(TST)/lin2txt.o $(LIBGSMSO) $(LDLIB)
 
-$(TST)/lin2cod:		$(TST)/lin2cod.o $(LIBGSM)
+$(TST)/lin2cod:		$(TST)/lin2cod.o $(LIBGSMSO)
 			$(LD) $(LFLAGS) -o $(TST)/lin2cod \
-				$(TST)/lin2cod.o $(LIBGSM) $(LDLIB)
+				$(TST)/lin2cod.o $(LIBGSMSO) $(LDLIB)
 
-$(TST)/gsm2cod:		$(TST)/gsm2cod.o $(LIBGSM)
+$(TST)/gsm2cod:		$(TST)/gsm2cod.o $(LIBGSMSO)
 			$(LD) $(LFLAGS) -o $(TST)/gsm2cod \
-				$(TST)/gsm2cod.o $(LIBGSM) $(LDLIB)
+				$(TST)/gsm2cod.o $(LIBGSMSO) $(LDLIB)
 
-$(TST)/cod2txt:		$(TST)/cod2txt.o $(LIBGSM)
+$(TST)/cod2txt:		$(TST)/cod2txt.o $(LIBGSMSO)
 			$(LD) $(LFLAGS) -o $(TST)/cod2txt \
-				$(TST)/cod2txt.o $(LIBGSM) $(LDLIB)
+				$(TST)/cod2txt.o $(LIBGSMSO) $(LDLIB)
 
-$(TST)/cod2lin:		$(TST)/cod2lin.o $(LIBGSM)
+$(TST)/cod2lin:		$(TST)/cod2lin.o $(LIBGSMSO)
 			$(LD) $(LFLAGS) -o $(TST)/cod2lin \
-				$(TST)/cod2lin.o $(LIBGSM) $(LDLIB)
+				$(TST)/cod2lin.o $(LIBGSMSO) $(LDLIB)