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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
|
--- Makefile.orig 2022-07-03 18:49:29.000000000 +0100
+++ Makefile 2022-07-15 15:06:58.340000000 +0100
@@ -75,6 +75,8 @@
# What's this release's version? Part of the directory and archive file name.
VERSION = 1.0-pl20
+# VER is used as the actual lib version
+VER ?= 1.0.20
# Where do you want to install the gsm library, header file, and manpages?
#
@@ -99,7 +101,7 @@
# Other tools
SHELL = /bin/sh
-LN = ln
+LN = ln -s
BASENAME = basename
AR = ar
ARFLAGS = cr
@@ -143,6 +145,7 @@
# Targets
LIBGSM = $(LIB)/libgsm.a
+LIBGSMSO= $(LIB)/libgsm.so
TOAST = $(BIN)/toast
UNTOAST = $(BIN)/untoast
@@ -206,24 +209,43 @@
# Object files
-GSM_OBJECTS = $(SRC)/add.o \
- $(SRC)/code.o \
- $(SRC)/debug.o \
- $(SRC)/decode.o \
- $(SRC)/long_term.o \
- $(SRC)/lpc.o \
- $(SRC)/preprocess.o \
- $(SRC)/rpe.o \
- $(SRC)/gsm_destroy.o \
- $(SRC)/gsm_decode.o \
- $(SRC)/gsm_encode.o \
- $(SRC)/gsm_explode.o \
- $(SRC)/gsm_implode.o \
- $(SRC)/gsm_create.o \
- $(SRC)/gsm_print.o \
- $(SRC)/gsm_option.o \
- $(SRC)/short_term.o \
- $(SRC)/table.o
+STATIC_GSM_OBJECTS = $(SRC)/add.o \
+ $(SRC)/code.o \
+ $(SRC)/debug.o \
+ $(SRC)/decode.o \
+ $(SRC)/long_term.o \
+ $(SRC)/lpc.o \
+ $(SRC)/preprocess.o \
+ $(SRC)/rpe.o \
+ $(SRC)/gsm_destroy.o \
+ $(SRC)/gsm_decode.o \
+ $(SRC)/gsm_encode.o \
+ $(SRC)/gsm_explode.o \
+ $(SRC)/gsm_implode.o \
+ $(SRC)/gsm_create.o \
+ $(SRC)/gsm_print.o \
+ $(SRC)/gsm_option.o \
+ $(SRC)/short_term.o \
+ $(SRC)/table.o
+
+SHARED_GSM_OBJECTS = $(SRC)/add.lo \
+ $(SRC)/code.lo \
+ $(SRC)/debug.lo \
+ $(SRC)/decode.lo \
+ $(SRC)/long_term.lo \
+ $(SRC)/lpc.lo \
+ $(SRC)/preprocess.lo \
+ $(SRC)/rpe.lo \
+ $(SRC)/gsm_destroy.lo \
+ $(SRC)/gsm_decode.lo \
+ $(SRC)/gsm_encode.lo \
+ $(SRC)/gsm_explode.lo \
+ $(SRC)/gsm_implode.lo \
+ $(SRC)/gsm_create.lo \
+ $(SRC)/gsm_print.lo \
+ $(SRC)/gsm_option.lo \
+ $(SRC)/short_term.lo \
+ $(SRC)/table.lo
TOAST_OBJECTS = $(SRC)/toast.o \
$(SRC)/toast_lin.o \
@@ -231,7 +253,7 @@
$(SRC)/toast_alaw.o \
$(SRC)/toast_audio.o
-OBJECTS = $(GSM_OBJECTS) $(TOAST_OBJECTS)
+OBJECTS = $(STATIC_GSM_OBJECTS) $(SHARED_GSM_OBJECTS) $(TOAST_OBJECTS)
# Manuals
@@ -280,9 +302,12 @@
$(CC) $(CFLAGS) $?
@-mv `$(BASENAME) $@` $@ > /dev/null 2>&1
+%.lo: %.c
+ $(CC) $(CFLAGS) -fPIC -c $< -o $@
+
# 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
@@ -302,24 +327,29 @@
# The basic API: libgsm
-$(LIBGSM): $(LIB) $(GSM_OBJECTS)
+$(LIBGSMSO): $(LIB) $(SHARED_GSM_OBJECTS)
+ $(LD) $(LFLAGS) -o $@.${VER} -shared -Xlinker -soname -Xlinker libgsm.so.1 $(SHARED_GSM_OBJECTS) -lc
+ ln -fs libgsm.so.${VER} lib/libgsm.so.1
+ ln -fs libgsm.so.${VER} lib/libgsm.so
+
+$(LIBGSM): $(LIB) $(STATIC_GSM_OBJECTS)
-rm $(RMFLAGS) $(LIBGSM)
- $(AR) $(ARFLAGS) $(LIBGSM) $(GSM_OBJECTS)
+ $(AR) $(ARFLAGS) $(LIBGSM) $(STATIC_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) $(LIBGSMSO) $(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
@@ -429,7 +459,9 @@
clean: semi-clean
-rm $(RMFLAGS) $(LIBGSM) $(ADDTST)/add \
- $(TOAST) $(TCAT) $(UNTOAST) \
+ $(LIBGSMSO) $(LIB)/libgsm.so.${VER} \
+ $(LIB)libgsm.so.1 \
+ $(TOAST) $(TCAT) $(UNTOAST) \
$(ROOT)/gsm-1.0.tar.gz
|