1 # Copyright 1992-1996 by Jutta Degener and Carsten Bormann, Technische
2 # Universitaet Berlin. See the accompanying file "COPYRIGHT" for
3 # details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
5 # Machine- or installation dependent flags you should configure to port
8 ######### Define SASR if >> is a signed arithmetic shift (-1 >> 1 == -1)
10 #MULHACK = -DUSE_FLOAT_MUL
11 ######### Define this if your host multiplies floats faster than integers,
12 ######### e.g. on a SPARCstation.
15 ######### Define together with USE_FLOAT_MUL to enable the GSM library's
16 ######### approximation option for incorrect, but good-enough results.
20 ######### Define to enable the GSM library's long-term correlation
21 ######### approximation option---faster, but worse; works for
22 ######### both integer and floating point multiplications.
23 ######### This flag is still in the experimental stage.
27 ######### Define to enable the GSM library's option to pack GSM frames
28 ######### in the style used by the WAV #49 format. If you want to write
29 ######### a tool that produces .WAV files which contain GSM-encoded data,
30 ######### define this, and read about the GSM_OPT_WAV49 option in the
31 ######### manual page on gsm_option(3).
35 ######### Define to enable MMXTM optimizations for x86 architecture CPU's
36 ######### which support MMX instructions. This should be newer pentiums,
37 ######### ppro's, etc, as well as the AMD K6 and K7. The compile will
38 ######### probably require gcc.
40 ifneq (${OSARCH},Darwin)
41 ifneq (${PROC},x86_64)
42 OPTIMIZE+=-march=$(PROC)
48 ######### Profiling flags. If you don't know what that means, leave it blank.
50 # Choose a compiler. The code works both with ANSI and K&R-C.
51 # Use -DNeedFunctionPrototypes to compile with, -UNeedFunctionPrototypes to
52 # compile without, function prototypes in the header files.
54 # You can use the -DSTUPID_COMPILER to circumvent some compilers'
55 # static limits regarding the number of subexpressions in a statement.
58 # CCFLAGS = -c -DSTUPID_COMPILER
63 CC = gcc $(OPTIMIZE) -fomit-frame-pointer
64 CCFLAGS += -c -DNeedFunctionPrototypes=1 -funroll-loops -fPIC
72 # If your compiler needs additional flags/libraries, regardless of
73 # the source compiled, configure them here.
75 # CCINC = -I/usr/gnu/lib/gcc-2.1/gcc-lib/sparc-sun-sunos4.1.2/2.1/include
76 ######### Includes needed by $(CC)
78 # LDINC = -L/usr/gnu/lib/gcc-2.1/gcc-lib/sparc-sun-sunos4.1.2/2.1
79 ######### Library paths needed by $(LD)
82 ######### Additional libraries needed by $(LD)
85 # Where do you want to install libraries, binaries, a header file
86 # and the manual pages?
88 # Leave INSTALL_ROOT empty (or just don't execute "make install") to
89 # not install gsm and toast outside of this directory.
93 # Where do you want to install the gsm library, header file, and manpages?
95 # Leave GSM_INSTALL_ROOT empty to not install the GSM library outside of
98 GSM_INSTALL_ROOT = $(INSTALL_ROOT)
99 GSM_INSTALL_LIB = $(GSM_INSTALL_ROOT)/lib
100 GSM_INSTALL_INC = $(GSM_INSTALL_ROOT)/inc
101 GSM_INSTALL_MAN = $(GSM_INSTALL_ROOT)/man/man3
104 # Where do you want to install the toast binaries and their manpage?
106 # Leave TOAST_INSTALL_ROOT empty to not install the toast binaries outside
109 TOAST_INSTALL_ROOT = $(INSTALL_ROOT)
110 TOAST_INSTALL_BIN = $(TOAST_INSTALL_ROOT)/bin
111 TOAST_INSTALL_MAN = $(TOAST_INSTALL_ROOT)/man/man1
128 # You shouldn't have to configure below this line if you're porting.
135 ADDTST = $(ROOT)/add-test
147 ######### Remove -DNDEBUG to enable assertions.
149 CFLAGS = $(PG) $(CCFLAGS) $(SASR) $(DEBUG) $(MULHACK) $(FAST) \
150 $(LTP_CUT) $(WAV49) $(K6OPT) $(CCINC) -I$(INC)
151 ######### It's $(CC) $(CFLAGS)
153 LFLAGS = $(PG) $(LDFLAGS) $(LDINC)
154 ######### It's $(LD) $(LFLAGS)
159 LIBGSM = $(LIB)/libgsm.a
160 LIBGSMSO= $(LIB)/libgsm.so
163 UNTOAST = $(BIN)/untoast
168 GSM_HEADERS = $(INC)/gsm.h
170 HEADERS = $(INC)/proto.h \
180 GSM_SOURCES = $(SRC)/add.c \
186 $(SRC)/preprocess.c \
188 $(SRC)/gsm_destroy.c \
189 $(SRC)/gsm_decode.c \
190 $(SRC)/gsm_encode.c \
191 $(SRC)/gsm_explode.c \
192 $(SRC)/gsm_implode.c \
193 $(SRC)/gsm_create.c \
195 $(SRC)/gsm_option.c \
196 $(SRC)/short_term.c \
198 ifeq (${OSARCH},Linux)
199 ifneq (${PROC},x86_64)
200 GSM_SOURCES+= $(SRC)/k6opt.s
204 TOAST_SOURCES = $(SRC)/toast.c \
206 $(SRC)/toast_ulaw.c \
207 $(SRC)/toast_alaw.c \
210 SOURCES = $(GSM_SOURCES) \
212 $(ADDTST)/add_test.c \
229 GSM_OBJECTS = $(SRC)/add.o \
235 $(SRC)/preprocess.o \
237 $(SRC)/gsm_destroy.o \
238 $(SRC)/gsm_decode.o \
239 $(SRC)/gsm_encode.o \
240 $(SRC)/gsm_explode.o \
241 $(SRC)/gsm_implode.o \
242 $(SRC)/gsm_create.o \
244 $(SRC)/gsm_option.o \
245 $(SRC)/short_term.o \
247 ifeq (${OSARCH},Linux)
248 ifneq (${PROC},x86_64)
249 GSM_OBJECTS+= $(SRC)/k6opt.o
253 TOAST_OBJECTS = $(SRC)/toast.o \
255 $(SRC)/toast_ulaw.o \
256 $(SRC)/toast_alaw.o \
259 OBJECTS = $(GSM_OBJECTS) $(TOAST_OBJECTS)
263 GSM_MANUALS = $(MAN)/gsm.3 \
264 $(MAN)/gsm_explode.3 \
265 $(MAN)/gsm_option.3 \
268 TOAST_MANUALS = $(MAN)/toast.1
270 MANUALS = $(GSM_MANUALS) $(TOAST_MANUALS) $(MAN)/bitter.1
272 # Other stuff in the distribution
280 $(ADDTST)/add_test.dta \
287 GSM_INSTALL_TARGETS = \
288 $(GSM_INSTALL_LIB)/libgsm.a \
289 $(GSM_INSTALL_INC)/gsm.h \
290 $(GSM_INSTALL_MAN)/gsm.3 \
291 $(GSM_INSTALL_MAN)/gsm_explode.3 \
292 $(GSM_INSTALL_MAN)/gsm_option.3 \
293 $(GSM_INSTALL_MAN)/gsm_print.3
295 TOAST_INSTALL_TARGETS = \
296 $(TOAST_INSTALL_BIN)/toast \
297 $(TOAST_INSTALL_BIN)/tcat \
298 $(TOAST_INSTALL_BIN)/untoast \
299 $(TOAST_INSTALL_MAN)/toast.1
306 @-mv `$(BASENAME) $@` $@ > /dev/null 2>&1
310 all: $(LIBGSM) $(LIBGSMSO) $(TOAST) $(TCAT) $(UNTOAST)
311 @-echo $(ROOT): Done.
313 tst: $(TST)/lin2cod $(TST)/cod2lin $(TOAST) $(TST)/test-result
316 addtst: $(ADDTST)/add $(ADDTST)/add_test.dta
317 $(ADDTST)/add < $(ADDTST)/add_test.dta > /dev/null
320 misc: $(TLS)/sweet $(TLS)/bitter $(TLS)/sour $(TLS)/ginger \
321 $(TST)/lin2txt $(TST)/cod2txt $(TST)/gsm2cod
324 install: toastinstall gsminstall
325 @-echo install: Done.
328 # The basic API: libgsm
330 $(LIBGSMSO): $(LIB) $(GSM_OBJECTS)
331 $(LD) -o $@.1.0.10 -shared -Xlinker -soname -Xlinker libgsm.so.1 $(GSM_OBJECTS) -lc
332 ln -fs libgsm.so.1.0.10 lib/libgsm.so.1
333 ln -fs libgsm.so.1.0.10 lib/libgsm.so
335 $(LIBGSM): $(LIB) $(GSM_OBJECTS)
336 -rm $(RMFLAGS) $(LIBGSM)
337 $(AR) $(ARFLAGS) $(LIBGSM) $(GSM_OBJECTS)
341 # Toast, Untoast and Tcat -- the compress-like frontends to gsm.
343 $(TOAST): $(BIN) $(TOAST_OBJECTS) $(LIBGSM)
344 $(LD) $(LFLAGS) -o $(TOAST) $(TOAST_OBJECTS) $(LIBGSMSO) $(LDLIB)
346 $(UNTOAST): $(BIN) $(TOAST)
347 -rm $(RMFLAGS) $(UNTOAST)
348 $(LN) toast $(UNTOAST)
350 $(TCAT): $(BIN) $(TOAST)
351 -rm $(RMFLAGS) $(TCAT)
355 # The local bin and lib directories
358 if [ ! -d $(BIN) ] ; then mkdir $(BIN) ; fi
361 if [ ! -d $(LIB) ] ; then mkdir $(LIB) ; fi
367 -if [ x"$(GSM_INSTALL_ROOT)" != x ] ; then \
368 $(MAKE) $(GSM_INSTALL_TARGETS) ; \
372 -if [ x"$(TOAST_INSTALL_ROOT)" != x ]; then \
373 $(MAKE) $(TOAST_INSTALL_TARGETS); \
377 -if [ x"$(GSM_INSTALL_ROOT)" != x ] ; then \
378 rm $(RMFLAGS) $(GSM_INSTALL_TARGETS) ; \
382 -if [ x"$(TOAST_INSTALL_ROOT)" != x ] ; then \
383 rm $(RMFLAGS) $(TOAST_INSTALL_TARGETS); \
386 $(TOAST_INSTALL_BIN)/toast: $(TOAST)
391 $(TOAST_INSTALL_BIN)/untoast: $(TOAST_INSTALL_BIN)/toast
395 $(TOAST_INSTALL_BIN)/tcat: $(TOAST_INSTALL_BIN)/toast
399 $(TOAST_INSTALL_MAN)/toast.1: $(MAN)/toast.1
404 $(GSM_INSTALL_MAN)/gsm.3: $(MAN)/gsm.3
409 $(GSM_INSTALL_MAN)/gsm_option.3: $(MAN)/gsm_option.3
414 $(GSM_INSTALL_MAN)/gsm_explode.3: $(MAN)/gsm_explode.3
419 $(GSM_INSTALL_MAN)/gsm_print.3: $(MAN)/gsm_print.3
424 $(GSM_INSTALL_INC)/gsm.h: $(INC)/gsm.h
429 $(GSM_INSTALL_LIB)/libgsm.a: $(LIBGSM)
440 gsm-1.0.tar.Z: $(STUFF) $(SOURCES) $(HEADERS) $(MANUALS)
442 tar cvf - `cat $(ROOT)/gsm-1.0/MANIFEST \
444 ) | $(COMPRESS) $(COMPRESSFLAGS) > $(ROOT)/gsm-1.0.tar.Z
448 uninstall: toastuninstall gsmuninstall
449 @-echo uninstall: Done.
452 -rm $(RMFLAGS) */*.o \
453 $(TST)/lin2cod $(TST)/lin2txt \
454 $(TST)/cod2lin $(TST)/cod2txt \
457 -$(FIND) . \( -name core -o -name foo \) \
458 -print | xargs rm $(RMFLAGS)
461 -rm $(RMFLAGS) $(LIBGSM) $(ADDTST)/add \
462 $(TOAST) $(TCAT) $(UNTOAST) \
463 $(ROOT)/gsm-1.0.tar.Z
466 # Two tools that helped me generate gsm_encode.c and gsm_decode.c,
467 # but aren't generally needed to port this.
469 $(TLS)/sweet: $(TLS)/sweet.o $(TLS)/taste.o
470 $(LD) $(LFLAGS) -o $(TLS)/sweet \
471 $(TLS)/sweet.o $(TLS)/taste.o $(LDLIB)
473 $(TLS)/bitter: $(TLS)/bitter.o $(TLS)/taste.o
474 $(LD) $(LFLAGS) -o $(TLS)/bitter \
475 $(TLS)/bitter.o $(TLS)/taste.o $(LDLIB)
477 # A version of the same family that Jeff Chilton used to implement
478 # the WAV #49 GSM format.
480 $(TLS)/ginger: $(TLS)/ginger.o $(TLS)/taste.o
481 $(LD) $(LFLAGS) -o $(TLS)/ginger \
482 $(TLS)/ginger.o $(TLS)/taste.o $(LDLIB)
484 $(TLS)/sour: $(TLS)/sour.o $(TLS)/taste.o
485 $(LD) $(LFLAGS) -o $(TLS)/sour \
486 $(TLS)/sour.o $(TLS)/taste.o $(LDLIB)
488 # Run $(ADDTST)/add < $(ADDTST)/add_test.dta to make sure the
489 # basic arithmetic functions work as intended.
491 $(ADDTST)/add: $(ADDTST)/add_test.o
492 $(LD) $(LFLAGS) -o $(ADDTST)/add $(ADDTST)/add_test.o $(LDLIB)
495 # Various conversion programs between linear, text, .gsm and the code
496 # format used by the tests we ran (.cod). We paid for the test data,
497 # so I guess we can't just provide them with this package. Still,
498 # if you happen to have them lying around, here's the code.
500 # You can use gsm2cod | cod2txt independently to look at what's
501 # coded inside the compressed frames, although this shouldn't be
502 # hard to roll on your own using the gsm_print() function from
506 $(TST)/test-result: $(TST)/lin2cod $(TST)/cod2lin $(TOAST) $(TST)/run
509 $(TST)/lin2txt: $(TST)/lin2txt.o $(LIBGSM)
510 $(LD) $(LFLAGS) -o $(TST)/lin2txt \
511 $(TST)/lin2txt.o $(LIBGSM) $(LDLIB)
513 $(TST)/lin2cod: $(TST)/lin2cod.o $(LIBGSM)
514 $(LD) $(LFLAGS) -o $(TST)/lin2cod \
515 $(TST)/lin2cod.o $(LIBGSM) $(LDLIB)
517 $(TST)/gsm2cod: $(TST)/gsm2cod.o $(LIBGSM)
518 $(LD) $(LFLAGS) -o $(TST)/gsm2cod \
519 $(TST)/gsm2cod.o $(LIBGSM) $(LDLIB)
521 $(TST)/cod2txt: $(TST)/cod2txt.o $(LIBGSM)
522 $(LD) $(LFLAGS) -o $(TST)/cod2txt \
523 $(TST)/cod2txt.o $(LIBGSM) $(LDLIB)
525 $(TST)/cod2lin: $(TST)/cod2lin.o $(LIBGSM)
526 $(LD) $(LFLAGS) -o $(TST)/cod2lin \
527 $(TST)/cod2lin.o $(LIBGSM) $(LDLIB)