From adef31698f99313e0194d69980c7e1aef8ced6d3 Mon Sep 17 00:00:00 2001
From: Tilghman Lesher <tilghman@meg.abyt.es>
Date: Mon, 13 Mar 2006 05:24:13 +0000
Subject: [PATCH] Bug 6709 - Simplify extensive embedded ifneq logic (and fix
 missing endif's)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@12714 65c4cc65-6c06-0410-ace0-fbb531ad65f3
---
 codecs/gsm/Makefile | 62 ++++++++-------------------------------------
 1 file changed, 11 insertions(+), 51 deletions(-)

diff --git a/codecs/gsm/Makefile b/codecs/gsm/Makefile
index f162b141b1..29b714cb9c 100644
--- a/codecs/gsm/Makefile
+++ b/codecs/gsm/Makefile
@@ -37,33 +37,13 @@ WAV49	= -DWAV49
 ######### ppro's, etc, as well as the AMD K6 and K7.  The compile will
 ######### probably require gcc. 
 
-ifneq (${OSARCH},Darwin)
-ifneq (${OSARCH},SunOS)
-ifneq (${PROC},x86_64)
-ifneq (${PROC},ultrasparc)
-ifneq ($(shell uname -m),ppc)
-ifneq ($(shell uname -m),ppc64)
-ifneq ($(shell uname -m),alpha)
-ifneq ($(shell uname -m),armv4l)
-ifneq (${PROC},sparc64)
-ifneq (${PROC},arm)
-ifneq (${PROC},ppc)
-ifneq (${PROC},ppc64)
-ifneq (${PROC},ia64)
+ifeq (, $(findstring $(OSARCH) , Darwin SunOS ))
+ifeq (, $(findstring $(PROC) , x86_64 ultrasparc sparc64 arm ppc ppc64 ia64 ))
+ifeq (, $(findstring $(shell uname -m) , ppc ppc64 alpha armv4l ))
 OPTIMIZE+=-march=$(PROC)
 endif
 endif
 endif
-endif
-endif
-endif
-endif
-endif
-endif
-endif
-endif
-endif
-endif
 
 #The problem with sparc is the best stuff is in newer versions of gcc (post 3.0) only.
 #This works for even old (2.96) versions of gcc and provides a small boost either way.
@@ -230,26 +210,17 @@ GSM_SOURCES =	$(SRC)/add.c		\
 		$(SRC)/gsm_option.c	\
 		$(SRC)/short_term.c	\
 		$(SRC)/table.c
+
+# add k6-specific code only if not on a non-k6 hardware or proc.
+# XXX Keep a space after each findstring argument
+# XXX should merge with GSM_OBJECTS
 ifeq (${OSARCH},Linux)
-ifneq ($(shell uname -m),x86_64)
-ifneq ($(shell uname -m),ppc)
-ifneq ($(shell uname -m),ppc64)
-ifneq ($(shell uname -m),alpha)
-ifneq ($(shell uname -m),armv4l)
-ifneq ($(shell uname -m),sparc64)
-ifneq (${PROC},arm)
-ifneq (${PROC},ia64)
-ifneq ($(shell uname -m), parisc)
+ifeq (,$(findstring $(shell uname -m) , x86_64 ppc ppc64 alpha armv4l sparc64 parisc ))
+ifeq (,$(findstring ${PROC} , arm ia64 ))
 GSM_SOURCES+= $(SRC)/k6opt.s
 endif
 endif
 endif
-endif
-endif
-endif
-endif
-endif
-endif
 
 TOAST_SOURCES = $(SRC)/toast.c 		\
 		$(SRC)/toast_lin.c	\
@@ -296,23 +267,12 @@ GSM_OBJECTS =	$(SRC)/add.o		\
 		$(SRC)/table.o
 
 ifeq (${OSARCH},Linux)
-ifneq ($(shell uname -m), x86_64)
-ifneq ($(shell uname -m), ppc)
-ifneq ($(shell uname -m), ppc64)
-ifneq ($(shell uname -m), alpha)
-ifneq ($(shell uname -m), sparc64)
-ifneq ($(shell uname -m), armv4l)
-ifneq (${PROC},ia64)
-ifneq ($(shell uname -m), parisc)
+ifeq (,$(findstring $(shell uname -m) , x86_64 ppc ppc64 alpha armv4l sparc64 parisc ))
+ifeq (,$(findstring ${PROC} , arm ia64 ))
 GSM_OBJECTS+= $(SRC)/k6opt.o
 endif
 endif
 endif
-endif
-endif
-endif
-endif
-endif
 
 TOAST_OBJECTS =	$(SRC)/toast.o 		\
 		$(SRC)/toast_lin.o	\
-- 
GitLab