Fix cross compiling (bug #3868)
authorMark Spencer <markster@digium.com>
Sun, 27 Mar 2005 22:39:17 +0000 (22:39 +0000)
committerMark Spencer <markster@digium.com>
Sun, 27 Mar 2005 22:39:17 +0000 (22:39 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5278 65c4cc65-6c06-0410-ace0-fbb531ad65f3

Makefile
apps/Makefile
cdr/Makefile
channels/Makefile
codecs/Makefile
codecs/gsm/Makefile
codecs/lpc10/Makefile
pbx/Makefile
res/Makefile
utils/Makefile

index 8eee585..20d1bbb 100755 (executable)
--- a/Makefile
+++ b/Makefile
 # Create OPTIONS variable
 OPTIONS=
 
+# If cross compiling, define these to suit
+# CROSS_COMPILE=/opt/montavista/pro/devkit/arm/xscale_be/bin/xscale_be-
+# CROSS_COMPILE_BIN=/opt/montavista/pro/devkit/arm/xscale_be/bin/
+# CROSS_COMPILE_TARGET=/opt/montavista/pro/devkit/arm/xscale_be/target
+# CC=$(CROSS_COMPILE)gcc
+# CROSS_ARCH=Linux
+# CROSS_PROC=arm
+# SUB_PROC=xscale # or maverick
+
+ifeq ($(CROSS_COMPILE),)
 OSARCH=$(shell uname -s)
+else
+OSARCH=$(CROSS_ARCH)
+endif
 
 ifeq (${OSARCH},Linux)
+ifeq ($(CROSS_COMPILE),)
 PROC=$(shell uname -m)
+else
+PROC=$(CROSS_PROC)
+endif
 ifeq ($(PROC),x86_64)
 # You must have GCC 3.4 to use k8, otherwise use athlon
 PROC=k8
@@ -38,6 +55,18 @@ OPTIONS+=$(shell if $(CC) -mcpu=v8 -S -o /dev/null -xc /dev/null >/dev/null 2>&1
 OPTIONS+=-fomit-frame-pointer
 endif
 
+ifeq ($(PROC),arm)
+# The Cirrus logic is the only heavily shipping arm processor with a real floating point unit
+ifeq ($(SUB_PROC),maverick)
+OPTIONS+=-fsigned-char -mcpu=ep9312
+else
+ifeq ($(SUB_PROC),xscale)
+OPTIONS+=-fsigned-char -msoft-float -mcpu=xscale
+else
+OPTIONS+=-fsigned-char -msoft-float 
+endif
+endif
+endif
 MPG123TARG=linux
 endif
 
@@ -81,9 +110,12 @@ DEBUG=-g #-pg
 # will be received more reliably
 #OPTIONS += -DRADIO_RELAX
 
-# If you don't have a lot of memory (e.g. embedded Asterisk), uncomment the
-# following to reduce the size of certain static buffers
-#OPTIONS += -DLOW_MEMORY
+# If you don't have a lot of memory (e.g. embedded Asterisk), define LOW_MEMORY
+# to reduce the size of certain static buffers
+
+ifneq ($(CROSS_COMPILE),)
+OPTIONS += -DLOW_MEMORY
+endif
 
 # Optional debugging parameters
 DEBUG_THREADS = #-DDEBUG_THREADS #-DDO_CRASH #-DDETECT_DEADLOCKS
@@ -142,22 +174,24 @@ CFLAGS+=$(OPTIMIZE)
 ifneq ($(PROC),ultrasparc)
 CFLAGS+=$(shell if $(CC) -march=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=$(PROC)"; fi)
 endif
+ifeq ($(PROC),ppc)
+CFLAGS+=-fsigned-char
+endif
 
-CFLAGS+=$(shell if uname -m | $(GREP) -q ppc; then echo "-fsigned-char"; fi)
-CFLAGS+=$(shell if [ -f /usr/include/osp/osp.h ]; then echo "-DOSP_SUPPORT -I/usr/include/osp" ; fi)
+CFLAGS+=$(shell if [ -f $(CROSS_COMPILE_TARGET)/usr/include/osp/osp.h ]; then echo "-DOSP_SUPPORT -I$(CROSS_COMPILE_TARGET)/usr/include/osp" ; fi)
 
 ifeq (${OSARCH},FreeBSD)
-OSVERSION=$(shell make -V OSVERSION -f /usr/share/mk/bsd.port.subdir.mk)
+OSVERSION=$(shell make -V OSVERSION -f $(CROSS_COMPILE_TARGET)/usr/share/mk/bsd.port.subdir.mk)
 CFLAGS+=$(shell if test ${OSVERSION} -lt 500016 ; then echo "-D_THREAD_SAFE"; fi)
 LIBS+=$(shell if test  ${OSVERSION} -lt 502102 ; then echo "-lc_r"; else echo "-pthread"; fi)
-INCLUDE+=-I/usr/local/include
-CFLAGS+=$(shell if [ -d /usr/local/include/spandsp ]; then echo "-I/usr/local/include/spandsp"; fi)
+INCLUDE+=-I$(CROSS_COMPILE_TARGET)/usr/local/include
+CFLAGS+=$(shell if [ -d $(CROSS_COMPILE_TARGET)/usr/local/include/spandsp ]; then echo "-I$(CROSS_COMPILE_TARGET)/usr/local/include/spandsp"; fi)
 MPG123TARG=freebsd
 endif # FreeBSD
 
 ifeq (${OSARCH},NetBSD)
 CFLAGS+=-pthread
-INCLUDE+=-I/usr/local/include -I/usr/pkg/include
+INCLUDE+=-I$(CROSS_COMPILE_TARGET)/usr/local/include -I$(CROSS_COMPILE_TARGET)/usr/pkg/include
 MPG123TARG=netbsd
 endif
 
@@ -166,20 +200,20 @@ CFLAGS+=-pthread
 endif
 ifeq (${OSARCH},SunOS)
 CFLAGS+=-Wcast-align -DSOLARIS
-INCLUDE+=-Iinclude/solaris-compat -I/usr/local/ssl/include
+INCLUDE+=-Iinclude/solaris-compat -I$(CROSS_COMPILE_TARGET)/usr/local/ssl/include
 endif
 
 #Uncomment this to use the older DSP routines
 #CFLAGS+=-DOLD_DSP_ROUTINES
 
-CFLAGS+=$(shell if [ -f /usr/include/linux/zaptel.h ]; then echo "-DZAPTEL_OPTIMIZATIONS"; fi)
-CFLAGS+=$(shell if [ -f /usr/local/include/zaptel.h ]; then echo "-DZAPTEL_OPTIMIZATIONS"; fi)
+CFLAGS+=$(shell if [ -f $(CROSS_COMPILE_TARGET)/usr/include/linux/zaptel.h ]; then echo "-DZAPTEL_OPTIMIZATIONS"; fi)
+CFLAGS+=$(shell if [ -f $(CROSS_COMPILE_TARGET)/usr/local/include/zaptel.h ]; then echo "-DZAPTEL_OPTIMIZATIONS"; fi)
 
 LIBEDIT=editline/libedit.a
 
 ASTERISKVERSION=$(shell if [ -f .version ]; then cat .version; else if [ -d CVS ]; then if [ -f CVS/Tag ] ; then echo "CVS-`sed 's/^T//g' CVS/Tag`-`date +"%D-%T"`"; else echo "CVS-HEAD-`date +"%D-%T"`"; fi; fi; fi)
 ASTERISKVERSIONNUM=$(shell if [ -d CVS ]; then echo 999999 ; else if [ -f .version ] ; then awk -F. '{printf "%02d%02d%02d", $$1, $$2, $$3}' .version ; else echo 000000 ; fi ; fi)
-HTTPDIR=$(shell if [ -d /var/www ]; then echo "/var/www"; else echo "/home/httpd"; fi)
+HTTPDIR=$(shell if [ -d $(CROSS_COMPILE_TARGET)/var/www ]; then echo "/var/www"; else echo "/home/httpd"; fi)
 RPMVERSION=$(shell if [ -f .version ]; then sed 's/[-\/:]/_/g' .version; else echo "unknown" ; fi)
 CFLAGS+=-DASTERISK_VERSION=\"$(ASTERISKVERSION)\"
 CFLAGS+=-DASTERISK_VERSION_NUM=$(ASTERISKVERSIONNUM)
@@ -216,13 +250,13 @@ ifeq (${OSARCH},FreeBSD)
 LIBS+=-lcrypto
 endif
 ifeq (${OSARCH},NetBSD)
-LIBS+=-lpthread -lcrypto -lm -L/usr/local/lib -L/usr/pkg/lib -lncurses
+LIBS+=-lpthread -lcrypto -lm -L$(CROSS_COMPILE_TARGET)/usr/local/lib -L$(CROSS_COMPILE_TARGET)/usr/pkg/lib -lncurses
 endif
 ifeq (${OSARCH},OpenBSD)
 LIBS=-lcrypto -lpthread -lm -lncurses
 endif
 ifeq (${OSARCH},SunOS)
-LIBS+=-lpthread -ldl -lnsl -lsocket -lresolv -L/usr/local/ssl/lib
+LIBS+=-lpthread -ldl -lnsl -lsocket -lresolv -L$(CROSS_COMPILE_TARGET)/usr/local/ssl/lib
 endif
 LIBS+=-lssl
 OBJS=io.o sched.o logger.o frame.o loader.o config.o channel.o \
@@ -243,10 +277,9 @@ endif
 ifeq (${OSARCH},SunOS)
 OBJS+=strcompat.o
 ASTLINK=
-SOLINK=-shared -fpic -L/usr/local/ssl/lib
+SOLINK=-shared -fpic -L$(CROSS_COMPILE_TARGET)/usr/local/ssl/lib
 endif
 
-CC=gcc
 INSTALL=install
 
 _all: all
index 8a4d5bf..0feec31 100755 (executable)
@@ -52,18 +52,17 @@ endif
 #APPS+=app_ivrdemo.so
 #APPS+=app_skel.so
 
-APPS+=$(shell if [ -f /usr/include/linux/zaptel.h ]; then echo "app_zapras.so app_meetme.so app_flash.so app_zapbarge.so app_zapscan.so" ; fi)
-APPS+=$(shell if [ -f /usr/local/include/zaptel.h ]; then echo "app_zapras.so app_meetme.so app_flash.so app_zapbarge.so app_zapscan.so" ; fi)
-APPS+=$(shell if [ -f /usr/include/osp/osp.h ]; then echo "app_osplookup.so" ; fi)
+APPS+=$(shell if [ -f $(CROSS_COMPILE_TARGET)/usr/include/linux/zaptel.h ]; then echo "app_zapras.so app_meetme.so app_flash.so app_zapbarge.so app_zapscan.so" ; fi)
+APPS+=$(shell if [ -f $(CROSS_COMPILE_TARGET)/usr/local/include/zaptel.h ]; then echo "app_zapras.so app_meetme.so app_flash.so app_zapbarge.so app_zapscan.so" ; fi)
+APPS+=$(shell if [ -f $(CROSS_COMPILE_TARGET)/usr/include/osp/osp.h ]; then echo "app_osplookup.so" ; fi)
 
-CURLLIBS=$(shell curl-config --libs)
+CURLLIBS=$(shell $(CROSS_COMPILE_BIN)curl-config --libs)
 ifneq (${CURLLIBS},)
        APPS+=app_curl.so
        ifeq (${OSARCH},OpenBSD)
-               CFLAGS+=-I/usr/local/include
+               CFLAGS+=-I$(CROSS_COMPILE_TARGET)/usr/local/include
        endif
-endif
-
+endif 
 CFLAGS+=-fPIC
 #
 # If you have MySQL 4.1 or later you can use ODBC
index a34cc54..9267f5a 100755 (executable)
@@ -21,7 +21,7 @@ PROC=$(shell uname -m)
 OSARCH=$(shell uname -s)
 
 ifeq (${OSARCH},FreeBSD)
-SOLINK+=-L/usr/local/lib
+SOLINK+=-L$(CROSS_COMPILE_TARGET)/usr/local/lib
 endif
 
 #The problem with sparc is the best stuff is in newer versions of gcc (post 3.0) only.
@@ -37,36 +37,36 @@ endif
 #
 # unixODBC stuff...
 #
-MODS+=$(shell if [ -f "/usr/include/odbcinst.h" ]; then echo "cdr_odbc.so"; fi)
-MODS+=$(shell if [ -f "/usr/local/include/odbcinst.h" ]; then echo "cdr_odbc.so"; fi) 
+MODS+=$(shell if [ -f "$(CROSS_COMPILE_TARGET)/usr/include/odbcinst.h" ]; then echo "cdr_odbc.so"; fi)
+MODS+=$(shell if [ -f "$(CROSS_COMPILE_TARGET)/usr/local/include/odbcinst.h" ]; then echo "cdr_odbc.so"; fi) 
 
 #
 # FreeTDS stuff...
 #
-MODS+=$(shell if [ -f "/usr/include/tds.h" ]; then echo "cdr_tds.so"; fi)
-MODS+=$(shell if [ -f "/usr/local/include/tds.h" ]; then echo "cdr_tds.so"; fi)
+MODS+=$(shell if [ -f "$(CROSS_COMPILE_TARGET)/usr/include/tds.h" ]; then echo "cdr_tds.so"; fi)
+MODS+=$(shell if [ -f "$(CROSS_COMPILE_TARGET)/usr/local/include/tds.h" ]; then echo "cdr_tds.so"; fi)
 
 #
 # PGSQL stuff...  Autoconf anyone??
 #
-MODS+=$(shell if [ -d /usr/local/pgsql/include ] || [ -d /usr/include/pgsql ] || [ -d /usr/local/include/pgsql ] || [ -d /opt/pgsql/include ] || [ -f /usr/include/libpq-fe.h ] ; then echo "cdr_pgsql.so"; fi)
-CFLAGS+=$(shell if [ -d /usr/local/pgsql/include ]; then echo "-I/usr/local/pgsql/include"; fi)
-CFLAGS+=$(shell if [ -d /usr/include/pgsql ]; then echo "-I/usr/include/pgsql"; fi)
-CFLAGS+=$(shell if [ -d /usr/include/postgresql ]; then echo "-I/usr/include/postgresql"; fi)
-CFLAGS+=$(shell if [ -d /usr/local/include/pgsql ]; then echo "-I/usr/local/include/pgsql"; fi)
-CFLAGS+=$(shell if [ -d /opt/pgsql/include ]; then echo "-I/opt/pgsql/include"; fi)
-#CFLAGS+=$(shell if [ -f /usr/include/libpq-fe.h ]; then echo "-I/usr/include"; fi)
+MODS+=$(shell if [ -d $(CROSS_COMPILE_TARGET)/usr/local/pgsql/include ] || [ -d $(CROSS_COMPILE_TARGET)/usr/include/pgsql ] || [ -d $(CROSS_COMPILE_TARGET)/usr/local/include/pgsql ] || [ -d $(CROSS_COMPILE_TARGET)/opt/pgsql/include ] || [ -f $(CROSS_COMPILE_TARGET)/usr/include/libpq-fe.h ] ; then echo "cdr_pgsql.so"; fi)
+CFLAGS+=$(shell if [ -d $(CROSS_COMPILE_TARGET)/usr/local/pgsql/include ]; then echo "-I$(CROSS_COMPILE_TARGET)/usr/local/pgsql/include"; fi)
+CFLAGS+=$(shell if [ -d $(CROSS_COMPILE_TARGET)/usr/include/pgsql ]; then echo "-I$(CROSS_COMPILE_TARGET)/usr/include/pgsql"; fi)
+CFLAGS+=$(shell if [ -d $(CROSS_COMPILE_TARGET)/usr/include/postgresql ]; then echo "-I$(CROSS_COMPILE_TARGET)/usr/include/postgresql"; fi)
+CFLAGS+=$(shell if [ -d $(CROSS_COMPILE_TARGET)/usr/local/include/pgsql ]; then echo "-I$(CROSS_COMPILE_TARGET)/usr/local/include/pgsql"; fi)
+CFLAGS+=$(shell if [ -d $(CROSS_COMPILE_TARGET)/opt/pgsql/include ]; then echo "-I$(CROSS_COMPILE_TARGET)/opt/pgsql/include"; fi)
+#CFLAGS+=$(shell if [ -f $(CROSS_COMPILE_TARGET)/usr/include/libpq-fe.h ]; then echo "-I$(CROSS_COMPILE_TARGET)/usr/include"; fi)
 MLFLAGS=
-MLFLAGS+=$(shell if [ -d /usr/lib/pgsql ]; then echo "-L/usr/lib/pgsql"; fi)
-MLFLAGS+=$(shell if [ -d /usr/local/pgsql/lib ]; then echo "-L/usr/local/pgsql/lib"; fi)
-MLFLAGS+=$(shell if [ -d /usr/local/lib/pgsql ]; then echo "-L/usr/local/lib/pgsql"; fi)
-MLFLAGS+=$(shell if [ -d /opt/pgsql/lib ]; then echo "-L/opt/pgsql/lib"; fi)
-MLFLAGS+=$(shell if [ -f /usr/lib/libpq.so ]; then echo "-L/usr/lib"; fi)
+MLFLAGS+=$(shell if [ -d $(CROSS_COMPILE_TARGET)/usr/lib/pgsql ]; then echo "-L$(CROSS_COMPILE_TARGET)/usr/lib/pgsql"; fi)
+MLFLAGS+=$(shell if [ -d $(CROSS_COMPILE_TARGET)/usr/local/pgsql/lib ]; then echo "-L$(CROSS_COMPILE_TARGET)/usr/local/pgsql/lib"; fi)
+MLFLAGS+=$(shell if [ -d $(CROSS_COMPILE_TARGET)/usr/local/lib/pgsql ]; then echo "-L$(CROSS_COMPILE_TARGET)/usr/local/lib/pgsql"; fi)
+MLFLAGS+=$(shell if [ -d $(CROSS_COMPILE_TARGET)/opt/pgsql/lib ]; then echo "-L$(CROSS_COMPILE_TARGET)/opt/pgsql/lib"; fi)
+MLFLAGS+=$(shell if [ -f $(CROSS_COMPILE_TARGET)/usr/lib/libpq.so ]; then echo "-L$(CROSS_COMPILE_TARGET)/usr/lib"; fi)
 
 #
 # SQLIte stuff...
 #
-MODS+=$(shell if [ -f "/usr/include/sqlite.h" ]; then echo "cdr_sqlite.so"; fi)
+MODS+=$(shell if [ -f "$(CROSS_COMPILE_TARGET)/usr/include/sqlite.h" ]; then echo "cdr_sqlite.so"; fi)
 
 all: depend $(MODS)
 
index 5769fc0..f20f04c 100755 (executable)
 # This program is free software, distributed under the terms of
 # the GNU General Public License
 #
-
+ifeq ($(CROSS_COMPILE),)
 OSARCH=$(shell uname -s)
 PROC=$(shell uname -m)
+else
+OSARCH=$(CROSS_ARCH)
+PROC=$(CROSS_PROC) 
+HOSTCC=gcc
+endif
 
 CHANNEL_LIBS=chan_modem.so chan_sip.so \
             chan_modem_aopen.so \
@@ -24,10 +29,10 @@ CHANNEL_LIBS=chan_modem.so chan_sip.so \
             chan_local.so chan_skinny.so chan_features.so
 
 ifeq (${OSARCH},OpenBSD)
-CFLAGS+=-I/usr/local/include
+CFLAGS+=-I$(CROSS_COMPILE_TARGET)/usr/local/include
 PTLIB=-lpt_OpenBSD_x86_r
 H323LIB=-lh323_OpenBSD_x86_r
-CHANH323LIB=-L/usr/local/lib
+CHANH323LIB=-L$(CROSS_COMPILE_TARGET)/usr/local/lib
 endif
 ifeq (${OSARCH},Linux)
 PTLIB=-lpt_linux_x86_r
@@ -44,12 +49,12 @@ ifeq (${OSARCH},FreeBSD)
 PTLIB=-lpt_FreeBSD_x86_r
 H323LIB=-lh323_FreeBSD_x86_r
 CHANH323LIB=-pthread
-SOLINK+=-L/usr/local/lib
+SOLINK+=-L$(CROSS_COMPILE_TARGET)/usr/local/lib
 endif
 ifeq (${OSARCH},NetBSD)
 PTLIB=-lpt_NetBSD_x86_r
 H323LIB=-lh323_NetBSD_x86_r
-SOLINK+=-L/usr/local/lib
+SOLINK+=-L$(CROSS_COMPILE_TARGET)/usr/local/lib
 endif
 ifneq (${OSARCH},Darwin)
 ifneq (${OSARCH},SunOS)
@@ -61,22 +66,22 @@ ifeq (${OSARCH},SunOS)
 SOLINK+=-lrt
 endif
 
-CHANNEL_LIBS+=$(shell [ -f /usr/include/linux/ixjuser.h ] && echo chan_phone.so)
-CHANNEL_LIBS+=$(shell [ -f /usr/local/include/ixjuser.h ] && echo chan_phone.so)
+CHANNEL_LIBS+=$(shell [ -f $(CROSS_COMPILE_TARGET)/usr/include/linux/ixjuser.h ] && echo chan_phone.so)
+CHANNEL_LIBS+=$(shell [ -f $(CROSS_COMPILE_TARGET)/usr/local/include/ixjuser.h ] && echo chan_phone.so)
 CHANNEL_LIBS+=$(shell [ -f h323/libchanh323.a ] && echo chan_h323.so)
 
 CFLAGS+=-Wno-missing-prototypes -Wno-missing-declarations
-CFLAGS+=$(shell [ ! -f /usr/include/linux/if_wanpipe.h ] && echo " -DOLD_SANGOMA_API")
-CHANNEL_LIBS+=$(shell [ -f /usr/include/alsa/asoundlib.h ] && echo "chan_alsa.so")
-CFLAGS+=$(shell [ -f /usr/lib/libpri.so.1 ] && echo " -DZAPATA_PRI")
-CFLAGS+=$(shell [ -f /usr/lib/libmfcr2.so.1 ] && echo " -DZAPATA_R2")
+CFLAGS+=$(shell [ ! -f $(CROSS_COMPILE_TARGET)/usr/include/linux/if_wanpipe.h ] && echo " -DOLD_SANGOMA_API")
+CHANNEL_LIBS+=$(shell [ -f $(CROSS_COMPILE_TARGET)/usr/include/alsa/asoundlib.h ] && echo "chan_alsa.so")
+CFLAGS+=$(shell [ -f $(CROSS_COMPILE_TARGET)/usr/lib/libpri.so.1 ] && echo " -DZAPATA_PRI")
+CFLAGS+=$(shell [ -f $(CROSS_COMPILE_TARGET)/usr/lib/libmfcr2.so.1 ] && echo " -DZAPATA_R2")
 CFLAGS+=$(shell [ -f alsa-monitor.h ] && echo " -DALSA_MONITOR")
-ZAPPRI=$(shell [ -f /usr/lib/libpri.so.1 ] && echo "-lpri")
-ZAPR2=$(shell [ -f /usr/lib/libmfcr2.so.1 ] && echo "-lmfcr2")
-CFLAGS+=$(shell [ -f /usr/include/linux/zaptel.h ] && echo "-DIAX_TRUNKING")
-CFLAGS+=$(shell [ -f /usr/local/include/zaptel.h ] && echo "-DIAX_TRUNKING")
-CHANNEL_LIBS+=$(shell [ -f /usr/include/vpbapi.h ] && echo "chan_vpb.so" )
-CFLAGS+=$(shell [ -f /usr/include/vpbapi.h ] && echo " -DLINUX")
+ZAPPRI=$(shell [ -f $(CROSS_COMPILE_TARGET)/usr/lib/libpri.so.1 ] && echo "-lpri")
+ZAPR2=$(shell [ -f $(CROSS_COMPILE_TARGET)/usr/lib/libmfcr2.so.1 ] && echo "-lmfcr2")
+CFLAGS+=$(shell [ -f $(CROSS_COMPILE_TARGET)/usr/include/linux/zaptel.h ] && echo "-DIAX_TRUNKING")
+CFLAGS+=$(shell [ -f $(CROSS_COMPILE_TARGET)/usr/local/include/zaptel.h ] && echo "-DIAX_TRUNKING")
+CHANNEL_LIBS+=$(shell [ -f $(CROSS_COMPILE_TARGET)/usr/include/vpbapi.h ] && echo "chan_vpb.so" )
+CFLAGS+=$(shell [ -f $(CROSS_COMPILE_TARGET)/usr/include/vpbapi.h ] && echo " -DLINUX")
 
 ALSA_SRC=chan_alsa.c
 ALSA_SRC+=$(shell [ -f alsa-monitor.h ] && echo "alsa-monitor.h")
@@ -88,10 +93,10 @@ CFLAGS+=#-DVOFRDUMPER
 
 ZAPDIR=/usr/lib
 
-CHANNEL_LIBS+=$(shell [ -f /usr/include/linux/zaptel.h ] && echo "chan_zap.so")
-CHANNEL_LIBS+=$(shell [ -f /usr/local/include/zaptel.h ] && echo "chan_zap.so")
+CHANNEL_LIBS+=$(shell [ -f $(CROSS_COMPILE_TARGET)/usr/include/linux/zaptel.h ] && echo "chan_zap.so")
+CHANNEL_LIBS+=$(shell [ -f $(CROSS_COMPILE_TARGET)/usr/local/include/zaptel.h ] && echo "chan_zap.so")
 
-CHANNEL_LIBS+=$(shell [ -f /usr/include/nbs.h ] && echo "chan_nbs.so" )
+CHANNEL_LIBS+=$(shell [ -f $(CROSS_COMPILE_TARGET)/usr/include/nbs.h ] && echo "chan_nbs.so" )
 
 ifndef OPENH323DIR
 OPENH323DIR=$(HOME)/openh323
@@ -116,11 +121,26 @@ ifneq ($(wildcard .depend),)
 include .depend
 endif
 
+ifeq ($(CROSS_COMPILE),)
 gentone: gentone.c
        $(CC) -o gentone gentone.c -lm
 
 gentone-ulaw: gentone-ulaw.c
        $(CC) -o gentone-ulaw gentone-ulaw.c -lm
+else
+gentone: gentone.c
+       $(HOSTCC) -o gentone gentone.c -lm
+
+gentone-ulaw: gentone-ulaw.c
+       $(HOSTCC) -o gentone-ulaw gentone-ulaw.c -lm
+
+gentone.cross: gentone.c
+       $(CC) -o gentone.cross gentone.c -lm
+
+gentone-ulaw.cross: gentone-ulaw.c
+       $(CC) -o gentone-ulaw.cross gentone-ulaw.c -lm
+
+endif
 
 busy.h: gentone
        ./gentone busy 480 620
@@ -153,7 +173,6 @@ chan_sip.so: chan_sip.o
 
 chan_alsa.o: $(ALSA_SRC)
 
-
 chan_alsa.so: chan_alsa.o
        $(CC) $(SOLINK) -o $@ $< -lasound -lm -ldl
 
index 31c67df..a5a3f72 100755 (executable)
 #MODG723=codec_g723_1.so codec_g723_1b.so
 MODG723=$(shell [ -f g723.1/coder.c ] && echo "codec_g723_1.so")
 MODG723+=$(shell [ -f g723.1b/coder2.c ] && echo "codec_g723_1b.so")
-MODSPEEX=$(shell [ -f /usr/include/speex.h ] || [ -f /usr/include/speex/speex.h ] || [ -f /usr/local/include/speex.h ] || [ -f /usr/local/include/speex/speex.h ] && echo "codec_speex.so")
+MODSPEEX=$(shell [ -f $(CROSS_COMPILE_TARGET)/usr/include/speex.h ] || [ -f $(CROSS_COMPILE_TARGET)/usr/include/speex/speex.h ] || [ -f $(CROSS_COMPILE_TARGET)/usr/local/include/speex.h ] || [ -f $(CROSS_COMPILE_TARGET)/usr/local/include/speex/speex.h ] && echo "codec_speex.so")
 MODILBC=$(shell [ -f ilbc/iLBC_decode.h ] && echo "codec_ilbc.so")
 CFLAGS+=-fPIC
-CFLAGS+=$(shell [ -f /usr/local/include/speex.h ] && echo "-I/usr/local/include")
-CFLAGS+=$(shell [ -f /usr/local/include/speex/speex.h ] && echo "-I/usr/local/include/speex")
-CFLAGS+=$(shell [ -f /usr/include/speex/speex.h ] && echo "-I/usr/include/speex")
+CFLAGS+=$(shell [ -f $(CROSS_COMPILE_TARGET)/usr/local/include/speex.h ] && echo "-I$(CROSS_COMPILE_TARGET)/usr/local/include")
+CFLAGS+=$(shell [ -f $(CROSS_COMPILE_TARGET)/usr/local/include/speex/speex.h ] && echo "-I$(CROSS_COMPILE_TARGET)/usr/local/include/speex")
+CFLAGS+=$(shell [ -f $(CROSS_COMPILE_TARGET)/usr/include/speex/speex.h ] && echo "-I$(CROSS_COMPILE_TARGET)/usr/include/speex")
 
 LIBG723=g723.1/libg723.a
 LIBG723B=g723.1b/libg723b.a
 LIBGSM=gsm/lib/libgsm.a
 LIBGSMT=gsm/lib/libgsm.a
 LIBLPC10=lpc10/liblpc10.a
-LIBSPEEX=$(shell [ -f /usr/local/lib/libspeex.a ] && echo "-L/usr/local/lib")
+LIBSPEEX=$(shell [ -f $(CROSS_COMPILE_TARGET)/usr/local/lib/libspeex.a ] && echo "-L$(CROSS_COMPILE_TARGET)/usr/local/lib")
 LIBSPEEX+=-lspeex -lm
 LIBILBC=ilbc/libilbc.a
 
index 5aeb11b..fc9fa6b 100755 (executable)
@@ -45,6 +45,7 @@ ifneq ($(shell uname -m),ppc)
 ifneq ($(shell uname -m),ppc64)
 ifneq ($(shell uname -m),alpha)
 ifneq (${PROC},sparc64)
+ifneq (${PROC},arm)
 OPTIMIZE+=-march=$(PROC)
 endif
 endif
@@ -54,6 +55,7 @@ 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.
@@ -222,6 +224,7 @@ ifneq ($(shell uname -m),ppc)
 ifneq ($(shell uname -m),ppc64)
 ifneq ($(shell uname -m),alpha)
 ifneq ($(shell uname -m),sparc64)
+ifneq (${PROC},arm)
 GSM_SOURCES+= $(SRC)/k6opt.s
 endif
 endif
@@ -229,6 +232,7 @@ endif
 endif
 endif
 endif
+endif
 
 TOAST_SOURCES = $(SRC)/toast.c                 \
                $(SRC)/toast_lin.c      \
index 0a2e030..01f7a7b 100755 (executable)
@@ -40,7 +40,9 @@ ifeq ($(PROC),ultrasparc)
         CFLAGS+= -mtune=$(PROC) -mcpu=v8 -O3 -fomit-frame-pointer
 else
 ifneq ($(OSARCH),SunOS)
-        CFLAGS+= -march=$(PROC)
+ifneq  ($(OSARCH),arm)
+#        CFLAGS+= -march=$(PROC)
+endif
 endif
 endif
 endif
index 28ca0e0..c8a3483 100755 (executable)
@@ -16,7 +16,7 @@
 PBX_LIBS=pbx_config.so pbx_spool.so pbx_dundi.so pbx_loopback.so pbx_realtime.so
 
 # Add GTK console if appropriate
-#PBX_LIBS+=$(shell gtk-config --cflags >/dev/null 2>/dev/null && echo "pbx_gtkconsole.so")
+#PBX_LIBS+=$(shell $(CROSS_COMPILE_BIN)gtk-config --cflags >/dev/null 2>/dev/null && echo "pbx_gtkconsole.so")
 # Add KDE Console if appropriate
 #PBX_LIBS+=$(shell [ "$$QTDIR" != "" ] && echo "pbx_kdeconsole.so")
 
@@ -25,9 +25,8 @@ PBX_LIBS=pbx_config.so pbx_spool.so pbx_dundi.so pbx_loopback.so pbx_realtime.so
 #
 #PBX_LIBS+=pbx_wilcalu.so
 
-GTK_FLAGS=`gtk-config --cflags gthread`
-GTK_LIBS=`gtk-config --libs gthread`
-#CXX=egcs
+GTK_FLAGS=`${CROSS_COMPILE_BIN}gtk-config --cflags gthread`
+GTK_LIBS=`${CROSS_COMPILE_BIN}gtk-config --libs gthread`
 MOC=$(QTDIR)/bin/moc
 KDE_FLAGS=-I$(KDEDIR)/include -I$(KDEDIR)/include/kde -I$(QTDIR)/include
 KDE_LIBS=-L$(KDEDIR)/lib -L$(QTDIR)/lib -lqt -lkdecore -lkdeui
index a09eae1..df06973 100755 (executable)
 
 MODS=res_adsi.so res_features.so res_crypto.so res_musiconhold.so res_indications.so res_monitor.so \
      res_agi.so
-MODS+=$(shell if [ -f "/usr/include/odbcinst.h" ]; then echo "res_odbc.so res_config_odbc.so"; fi)
-MODS+=$(shell if [ -f "/usr/local/include/odbcinst.h" ]; then echo "res_odbc.so res_config_odbc.so"; fi)
-MODS+=$(shell if [ -f "/usr/include/osp/osp.h" ]; then echo "res_osp.so"; fi)
+MODS+=$(shell if [ -f "$(CROSS_COMPILE_TARGET)/usr/include/odbcinst.h" ]; then echo "res_odbc.so res_config_odbc.so"; fi)
+MODS+=$(shell if [ -f "$(CROSS_COMPILE_TARGET)/usr/local/include/odbcinst.h" ]; then echo "res_odbc.so res_config_odbc.so"; fi)
+MODS+=$(shell if [ -f "$(CROSS_COMPILE_TARGET)/usr/include/osp/osp.h" ]; then echo "res_osp.so"; fi)
 
 CRYPTO_LIBS=-lssl -lcrypto
 
 CFLAGS+=
-CFLAGS+=$(shell [ -f /usr/include/linux/zaptel.h ] && echo " -DZAPATA_MOH")
-CFLAGS+=$(shell [ -f /usr/local/include/zaptel.h ] && echo " -DZAPATA_MOH")
+CFLAGS+=$(shell [ -f $(CROSS_COMPILE_TARGET)/usr/include/linux/zaptel.h ] && echo " -DZAPATA_MOH")
+CFLAGS+=$(shell [ -f $(CROSS_COMPILE_TARGET)/usr/local/include/zaptel.h ] && echo " -DZAPATA_MOH")
 #
 # Work around buggy RedHat 9.0
 #
 CFLAGS+=-DOPENSSL_NO_KRB5 -fPIC
-OSPLIB=/usr/lib/libosp.a
+OSPLIB=$(CROSS_COMPILE_TARGET)/usr/lib/libosp.a
 
 all: depend $(MODS)
 
index a3f04d1..2a7c583 100755 (executable)
@@ -5,13 +5,13 @@ CFLAGS+=-DNO_AST_MM
 
 OSARCH=$(shell uname -s)
 ifeq ($(findstring BSD,${OSARCH}),BSD)
-CFLAGS+=-I/usr/local/include -L/usr/local/lib
+CFLAGS+=-I$(CROSS_COMPILE_TARGET)/usr/local/include -L$(CROSS_COMPILE_TARGET)/usr/local/lib
 endif
 
 TARGET=stereorize
 
-TARGET+=$(shell if [ -f /usr/include/popt.h ]; then echo "smsq"; else if [ -f /usr/local/include/popt.h ]; then echo "smsq"; fi ; fi)
-TARGET+=$(shell if [ -f /usr/include/newt.h ]; then echo "astman"; else if [ -f /usr/local/include/newt.h ]; then echo "astman"; fi ; fi)
+TARGET+=$(shell if [ -f $(CROSS_COMPILE_TARGET)/usr/include/popt.h ]; then echo "smsq"; else if [ -f $(CROSS_COMPILE_TARGET)/usr/local/include/popt.h ]; then echo "smsq"; fi ; fi)
+TARGET+=$(shell if [ -f $(CROSS_COMPILE_TARGET)/usr/include/newt.h ]; then echo "astman"; else if [ -f $(CROSS_COMPILE_TARGET)/usr/local/include/newt.h ]; then echo "astman"; fi ; fi)
 ifeq (${OSARCH},SunOS)
 SOL=../strcompat.o
 endif