--- palantir-2.7.orig/server/libgsm/Makefile	2007-03-31 11:50:49.000000000 +0200
+++ palantir-2.7/server/libgsm/Makefile	2011-01-20 15:22:46.318658281 +0100
@@ -49,11 +49,11 @@ WAV49	= -DWAV49
 # CCFLAGS 	= -c -O
 
 ifndef CC
-CC		= gcc
+CC		?= gcc
 endif
 
-CC		+= -ansi -pedantic
-CCFLAGS 	= -c -O2 -DNeedFunctionPrototypes=1
+CFLAGS		+= -ansi -pedantic
+CPPFLAGS 	?= -DNeedFunctionPrototypes=1
 
 LD 		= $(CC)
 
@@ -80,7 +80,7 @@ SHELL		= /bin/sh
 LN		= ln
 BASENAME 	= basename
 ifndef AR
-AR		= ar
+AR		?= ar
 endif
 ARFLAGS		= cr
 RMFLAGS		=
@@ -89,7 +89,7 @@ COMPRESS 	= compress
 COMPRESSFLAGS 	= 
 # RANLIB 	= true
 ifndef RANLIB
-RANLIB	 	= ranlib
+RANLIB	 	?= ranlib
 endif
 
 #
@@ -109,7 +109,7 @@ INC	= $(ROOT)/inc
 # DEBUG	= -DNDEBUG
 ######### Remove -DNDEBUG to enable assertions.
 
-CFLAGS	= $(CCFLAGS) $(SASR) $(DEBUG) $(MULHACK) $(FAST) $(LTP_CUT) \
+CFLAGS	+= $(SASR) $(DEBUG) $(MULHACK) $(FAST) $(LTP_CUT) \
 	$(WAV49) $(CCINC) -I$(INC)
 ######### It's $(CC) $(CFLAGS)
 
@@ -177,7 +177,7 @@ GSM_OBJECTS =	$(SRC)/add.o		\
 # Default rules
 
 .c.o:
-		$(CC) $(CFLAGS) $?
+		$(CC) $(CPPFLAGS) $(CFLAGS) -c $?
 		@-mv `$(BASENAME) $@` $@ > /dev/null 2>&1
 
 # Target rules
