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).
33 # Choose a compiler. The code works both with ANSI and K&R-C.
34 # Use -DNeedFunctionPrototypes to compile with, -UNeedFunctionPrototypes to
35 # compile without, function prototypes in the header files.
37 # You can use the -DSTUPID_COMPILER to circumvent some compilers'
38 # static limits regarding the number of subexpressions in a statement.
41 # CCFLAGS = -c -DSTUPID_COMPILER
46 CC = gcc -ansi -pedantic
47 CCFLAGS = -c -O2 -DNeedFunctionPrototypes=1
55 # If your compiler needs additional flags/libraries, regardless of
56 # the source compiled, configure them here.
58 # CCINC = -I/usr/gnu/lib/gcc-2.1/gcc-lib/sparc-sun-sunos4.1.2/2.1/include
59 ######### Includes needed by $(CC)
61 # LDINC = -L/usr/gnu/lib/gcc-2.1/gcc-lib/sparc-sun-sunos4.1.2/2.1
62 ######### Library paths needed by $(LD)
65 ######### Additional libraries needed by $(LD)
68 # Where do you want to install libraries, binaries, a header file
69 # and the manual pages?
71 # Leave INSTALL_ROOT empty (or just don't execute "make install") to
72 # not install gsm and toast outside of this directory.
76 # Where do you want to install the gsm library, header file, and manpages?
78 # Leave GSM_INSTALL_ROOT empty to not install the GSM library outside of
81 GSM_INSTALL_ROOT = $(INSTALL_ROOT)
82 GSM_INSTALL_LIB = $(GSM_INSTALL_ROOT)/lib
83 GSM_INSTALL_INC = $(GSM_INSTALL_ROOT)/inc
84 GSM_INSTALL_MAN = $(GSM_INSTALL_ROOT)/man/man3
87 # Where do you want to install the toast binaries and their manpage?
89 # Leave TOAST_INSTALL_ROOT empty to not install the toast binaries outside
92 TOAST_INSTALL_ROOT = $(INSTALL_ROOT)
93 TOAST_INSTALL_BIN = $(TOAST_INSTALL_ROOT)/bin
94 TOAST_INSTALL_MAN = $(TOAST_INSTALL_ROOT)/man/man1
111 # You shouldn't have to configure below this line if you're porting.
118 ADDTST = $(ROOT)/add-test
130 ######### Remove -DNDEBUG to enable assertions.
132 CFLAGS = $(CCFLAGS) $(SASR) $(DEBUG) $(MULHACK) $(FAST) $(LTP_CUT) \
133 $(WAV49) $(CCINC) -I$(INC)
134 ######### It's $(CC) $(CFLAGS)
136 LFLAGS = $(LDFLAGS) $(LDINC)
137 ######### It's $(LD) $(LFLAGS)
142 LIBGSM = $(LIB)/libgsm.a
145 UNTOAST = $(BIN)/untoast
150 GSM_HEADERS = $(INC)/gsm.h
152 HEADERS = $(INC)/proto.h \
162 GSM_SOURCES = $(SRC)/add.c \
168 $(SRC)/preprocess.c \
170 $(SRC)/gsm_destroy.c \
171 $(SRC)/gsm_decode.c \
172 $(SRC)/gsm_encode.c \
173 $(SRC)/gsm_explode.c \
174 $(SRC)/gsm_implode.c \
175 $(SRC)/gsm_create.c \
177 $(SRC)/gsm_option.c \
178 $(SRC)/short_term.c \
181 TOAST_SOURCES = $(SRC)/toast.c \
183 $(SRC)/toast_ulaw.c \
184 $(SRC)/toast_alaw.c \
187 SOURCES = $(GSM_SOURCES) \
189 $(ADDTST)/add_test.c \
206 GSM_OBJECTS = $(SRC)/add.o \
212 $(SRC)/preprocess.o \
214 $(SRC)/gsm_destroy.o \
215 $(SRC)/gsm_decode.o \
216 $(SRC)/gsm_encode.o \
217 $(SRC)/gsm_explode.o \
218 $(SRC)/gsm_implode.o \
219 $(SRC)/gsm_create.o \
221 $(SRC)/gsm_option.o \
222 $(SRC)/short_term.o \
225 TOAST_OBJECTS = $(SRC)/toast.o \
227 $(SRC)/toast_ulaw.o \
228 $(SRC)/toast_alaw.o \
231 OBJECTS = $(GSM_OBJECTS) $(TOAST_OBJECTS)
235 GSM_MANUALS = $(MAN)/gsm.3 \
236 $(MAN)/gsm_explode.3 \
237 $(MAN)/gsm_option.3 \
240 TOAST_MANUALS = $(MAN)/toast.1
242 MANUALS = $(GSM_MANUALS) $(TOAST_MANUALS) $(MAN)/bitter.1
244 # Other stuff in the distribution
252 $(ADDTST)/add_test.dta \
259 GSM_INSTALL_TARGETS = \
260 $(GSM_INSTALL_LIB)/libgsm.a \
261 $(GSM_INSTALL_INC)/gsm.h \
262 $(GSM_INSTALL_MAN)/gsm.3 \
263 $(GSM_INSTALL_MAN)/gsm_explode.3 \
264 $(GSM_INSTALL_MAN)/gsm_option.3 \
265 $(GSM_INSTALL_MAN)/gsm_print.3
267 TOAST_INSTALL_TARGETS = \
268 $(TOAST_INSTALL_BIN)/toast \
269 $(TOAST_INSTALL_BIN)/tcat \
270 $(TOAST_INSTALL_BIN)/untoast \
271 $(TOAST_INSTALL_MAN)/toast.1
278 @-mv `$(BASENAME) $@` $@ > /dev/null 2>&1
282 all: $(LIBGSM) $(TOAST) $(TCAT) $(UNTOAST)
283 @-echo $(ROOT): Done.
285 tst: $(TST)/lin2cod $(TST)/cod2lin $(TOAST) $(TST)/test-result
288 addtst: $(ADDTST)/add $(ADDTST)/add_test.dta
289 $(ADDTST)/add < $(ADDTST)/add_test.dta > /dev/null
292 misc: $(TLS)/sweet $(TLS)/bitter $(TLS)/sour $(TLS)/ginger \
293 $(TST)/lin2txt $(TST)/cod2txt $(TST)/gsm2cod
296 install: toastinstall gsminstall
297 @-echo install: Done.
300 # The basic API: libgsm
302 $(LIBGSM): $(LIB) $(GSM_OBJECTS)
303 -rm $(RMFLAGS) $(LIBGSM)
304 $(AR) $(ARFLAGS) $(LIBGSM) $(GSM_OBJECTS)
308 # Toast, Untoast and Tcat -- the compress-like frontends to gsm.
310 $(TOAST): $(BIN) $(TOAST_OBJECTS) $(LIBGSM)
311 $(LD) $(LFLAGS) -o $(TOAST) $(TOAST_OBJECTS) $(LIBGSM) $(LDLIB)
313 $(UNTOAST): $(BIN) $(TOAST)
314 -rm $(RMFLAGS) $(UNTOAST)
315 $(LN) $(TOAST) $(UNTOAST)
317 $(TCAT): $(BIN) $(TOAST)
318 -rm $(RMFLAGS) $(TCAT)
319 $(LN) $(TOAST) $(TCAT)
322 # The local bin and lib directories
325 if [ ! -d $(BIN) ] ; then mkdir $(BIN) ; fi
328 if [ ! -d $(LIB) ] ; then mkdir $(LIB) ; fi
334 -if [ x"$(GSM_INSTALL_ROOT)" != x ] ; then \
335 make $(GSM_INSTALL_TARGETS) ; \
339 -if [ x"$(TOAST_INSTALL_ROOT)" != x ]; then \
340 make $(TOAST_INSTALL_TARGETS); \
344 -if [ x"$(GSM_INSTALL_ROOT)" != x ] ; then \
345 rm $(RMFLAGS) $(GSM_INSTALL_TARGETS) ; \
349 -if [ x"$(TOAST_INSTALL_ROOT)" != x ] ; then \
350 rm $(RMFLAGS) $(TOAST_INSTALL_TARGETS); \
353 $(TOAST_INSTALL_BIN)/toast: $(TOAST)
358 $(TOAST_INSTALL_BIN)/untoast: $(TOAST_INSTALL_BIN)/toast
362 $(TOAST_INSTALL_BIN)/tcat: $(TOAST_INSTALL_BIN)/toast
366 $(TOAST_INSTALL_MAN)/toast.1: $(MAN)/toast.1
371 $(GSM_INSTALL_MAN)/gsm.3: $(MAN)/gsm.3
376 $(GSM_INSTALL_MAN)/gsm_option.3: $(MAN)/gsm_option.3
381 $(GSM_INSTALL_MAN)/gsm_explode.3: $(MAN)/gsm_explode.3
386 $(GSM_INSTALL_MAN)/gsm_print.3: $(MAN)/gsm_print.3
391 $(GSM_INSTALL_INC)/gsm.h: $(INC)/gsm.h
396 $(GSM_INSTALL_LIB)/libgsm.a: $(LIBGSM)
407 gsm-1.0.tar.Z: $(STUFF) $(SOURCES) $(HEADERS) $(MANUALS)
409 tar cvf - `cat $(ROOT)/gsm-1.0/MANIFEST \
411 ) | $(COMPRESS) $(COMPRESSFLAGS) > $(ROOT)/gsm-1.0.tar.Z
415 uninstall: toastuninstall gsmuninstall
416 @-echo uninstall: Done.
419 -rm $(RMFLAGS) */*.o \
420 $(TST)/lin2cod $(TST)/lin2txt \
421 $(TST)/cod2lin $(TST)/cod2txt \
424 -$(FIND) . \( -name core -o -name foo \) \
425 -print | xargs rm $(RMFLAGS)
428 -rm $(RMFLAGS) $(LIBGSM) $(ADDTST)/add \
429 $(TOAST) $(TCAT) $(UNTOAST) \
430 $(ROOT)/gsm-1.0.tar.Z
433 @echo dummy distclean
435 # Two tools that helped me generate gsm_encode.c and gsm_decode.c,
436 # but aren't generally needed to port this.
438 $(TLS)/sweet: $(TLS)/sweet.o $(TLS)/taste.o
439 $(LD) $(LFLAGS) -o $(TLS)/sweet \
440 $(TLS)/sweet.o $(TLS)/taste.o $(LDLIB)
442 $(TLS)/bitter: $(TLS)/bitter.o $(TLS)/taste.o
443 $(LD) $(LFLAGS) -o $(TLS)/bitter \
444 $(TLS)/bitter.o $(TLS)/taste.o $(LDLIB)
446 # A version of the same family that Jeff Chilton used to implement
447 # the WAV #49 GSM format.
449 $(TLS)/ginger: $(TLS)/ginger.o $(TLS)/taste.o
450 $(LD) $(LFLAGS) -o $(TLS)/ginger \
451 $(TLS)/ginger.o $(TLS)/taste.o $(LDLIB)
453 $(TLS)/sour: $(TLS)/sour.o $(TLS)/taste.o
454 $(LD) $(LFLAGS) -o $(TLS)/sour \
455 $(TLS)/sour.o $(TLS)/taste.o $(LDLIB)
457 # Run $(ADDTST)/add < $(ADDTST)/add_test.dta to make sure the
458 # basic arithmetic functions work as intended.
460 $(ADDTST)/add: $(ADDTST)/add_test.o
461 $(LD) $(LFLAGS) -o $(ADDTST)/add $(ADDTST)/add_test.o $(LDLIB)
464 # Various conversion programs between linear, text, .gsm and the code
465 # format used by the tests we ran (.cod). We paid for the test data,
466 # so I guess we can't just provide them with this package. Still,
467 # if you happen to have them lying around, here's the code.
469 # You can use gsm2cod | cod2txt independently to look at what's
470 # coded inside the compressed frames, although this shouldn't be
471 # hard to roll on your own using the gsm_print() function from
475 $(TST)/test-result: $(TST)/lin2cod $(TST)/cod2lin $(TOAST) $(TST)/run
478 $(TST)/lin2txt: $(TST)/lin2txt.o $(LIBGSM)
479 $(LD) $(LFLAGS) -o $(TST)/lin2txt \
480 $(TST)/lin2txt.o $(LIBGSM) $(LDLIB)
482 $(TST)/lin2cod: $(TST)/lin2cod.o $(LIBGSM)
483 $(LD) $(LFLAGS) -o $(TST)/lin2cod \
484 $(TST)/lin2cod.o $(LIBGSM) $(LDLIB)
486 $(TST)/gsm2cod: $(TST)/gsm2cod.o $(LIBGSM)
487 $(LD) $(LFLAGS) -o $(TST)/gsm2cod \
488 $(TST)/gsm2cod.o $(LIBGSM) $(LDLIB)
490 $(TST)/cod2txt: $(TST)/cod2txt.o $(LIBGSM)
491 $(LD) $(LFLAGS) -o $(TST)/cod2txt \
492 $(TST)/cod2txt.o $(LIBGSM) $(LDLIB)
494 $(TST)/cod2lin: $(TST)/cod2lin.o $(LIBGSM)
495 $(LD) $(LFLAGS) -o $(TST)/cod2lin \
496 $(TST)/cod2lin.o $(LIBGSM) $(LDLIB)