[Asterisk-Dev] how to load application with asterisk

Kamran Ahmad p_kami at yahoo.com
Mon Feb 21 02:09:28 MST 2005


i have written application using unixODBC functions
i have followed the skelton rules to write application
for asterisk.
it is compling well but when i try to load it it is
giving me error.
can any one check my makefile what is problem in it

app_prepaid_auth_pin.c is my code file

here is my make file

#
# Asterisk -- A telephony toolkit for Linux.
# 
# Makefile for PBX frontends (dynamically loaded)
#
# Copyright (C) 1999, Mark Spencer
#
# Mark Spencer <markster at linux-support.net>
#
# $Id: Makefile,v 1.20 2004/07/15 18:25:38 peternixon
Exp $
#
# This program is free software, distributed under the
terms of
# the GNU General Public License
#

#
# Set ASTERISKINCDIR variable to the directory
containing the sources of
# Asterisk PBX.
#
ASTERISKINCDIR=/usr/src/asterisk/include

#
# Set ASTERISKMODDIR variable to the directory where
ASTERISK's modules reside.
# The modules will be installed in this directory.
#
ASTERISKMODDIR=/usr/lib/asterisk/modules

#
# Set ASTERISKETCDIR variable to the directory where
ASTERISK's configuration
# files reside. The config files will be installed in
this directory.
#
ASTERISKETCDIR=/etc/asterisk


#ASTERISKINCLUDE=-I/usr/include/pgsql
-I/usr/local/pgsql -I/usr/local/pgsql/include
-I$(ASTERISKINCDIR)

#ASTERISKINCLUDE=-I/usr/include/mysql
-I$(ASTERISKINCDIR)
ASTERISKINCLUDE=-I/usr/local/unixODBC/include
-I$(ASTERISKINCDIR)

# Install the Prepaid billing apps
#APPS=app_prepaid_rate.so
#APPS+=app_prepaid_rateplan.so app_prepaid_auth_cid.so
app_callingcard.so
APPS=app_prepaid_auth_pin.so


CC=gcc
INSTALL=install

#Tell gcc to optimize the asterisk's code
OPTIMIZE=-O6

#Include debug symbols in the executables (-g) and
profiling info (-pg)
DEBUG=-g #-pg

INCLUDE=-Iinclude -I../include
CFLAGS=-pipe  -Wall -Wstrict-prototypes
-Wmissing-prototypes -Wmissing-declarations $(DEBUG)
$(INCLUDE) -D_REENTRANT -D_GNU_SOURCE
#-DMAKE_VALGRIND_HAPPY
CFLAGS+=$(OPTIMIZE)
CFLAGS+=$(shell if $(CC) -march=$(PROC) -S -o
/dev/null -xc /dev/null >/dev/null 2>&1; then echo
"-march=$(PROC)"; fi)
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)

ifeq (${OSARCH},FreeBSD)
OSVERSION=$(shell make -V OSVERSION -f
/usr/share/mk/bsd.port.subdir.mk)
CFLAGS+=$(if ${OSVERSION}<500016,-D_THREAD_SAFE)
LIBS+=$(if ${OSVERSION}<502102,-lc_r,-pthread)
INCLUDE+=-I/usr/local/include
CFLAGS+=$(shell if [ -d /usr/local/include/spandsp ];
then echo "-I/usr/local/include/spandsp"; fi)
endif # FreeBSD

ifeq (${OSARCH},OpenBSD)
CFLAGS+=-pthread
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)

LIBEDIT=editline/libedit.a

CFLAGS+= $(DEBUG_THREADS)
CFLAGS+= $(TRACE_FRAMES)
CFLAGS+= $(MALLOC_DEBUG)
CFLAGS+= $(BUSYDETECT)
CFLAGS+= $(OPTIONS)

CFLAGS+=-fPIC 
CFLAGS+= -lodbc
#CFLAGS+=-fPIC -lpthread -ldl -lncurses -lm
-lmysqlclient -lmysql

all: $(APPS)

clean:
	rm -f *.so *.o look .depend

%.so : %.o
	$(CC) $(SOLINK) -o $@ $<

install: all
	mkdir -p $(DESTDIR)$(ASTERISKMODDIR)
	for x in $(APPS); do $(INSTALL) -m 755 $$x
$(DESTDIR)$(ASTERISKMODDIR) ; done

#app_prepaid.o: app_prepaid.c
	$(CC) -pipe $(ASTERISKINCLUDE) $(CFLAGS) -c -o
app_prepaid.o app_prepaid.c

#app_prepaid.so: app_prepaid.o
	$(CC) -shared -Xlinker -x -o $@ $< -lpq

#app_callingcard.o: app_callingcard.c
	$(CC) -pipe $(ASTERISKINCLUDE) $(CFLAGS) -c -o
app_callingcard.o app_callingcard.c

#app_callingcard.so: app_callingcard.o
	$(CC) -shared -Xlinker -x -o $@ $< -lpq

#app_prepaid_auth_cid.o: app_prepaid_auth_cid.c
	$(CC) -pipe $(ASTERISKINCLUDE) $(CFLAGS) -c -o
app_prepaid_auth_cid.o app_prepaid_auth_cid.c

#app_prepaid_auth_cid.so: app_prepaid_auth_cid.o
	$(CC) -shared -Xlinker -x -o $@ $< -lpq

app_prepaid_auth_pin.o: app_prepaid_auth_pin.c
	$(CC) -pipe $(ASTERISKINCLUDE) $(CFLAGS) -c -o
app_prepaid_auth_pin.o app_prepaid_auth_pin.c

app_prepaid_auth_pin.so: app_prepaid_auth_pin.o
	$(CC) -shared -Xlinker -x -o $@ $< -lpq

#app_prepaid_rate.o: app_prepaid_rate.c
	$(CC) -pipe $(ASTERISKINCLUDE) $(CFLAGS) -c -o
app_prepaid_rate.o app_prepaid_rate.c

#app_prepaid_rate.so: app_prepaid_rate.o
	$(CC) -shared -Xlinker -x -o $@ $< -lpq -lpthread

#app_prepaid_rateplan.o: app_prepaid_rateplan.c
	$(CC) -pipe $(ASTERISKINCLUDE) $(CFLAGS) -c -o
app_prepaid_rateplan.o app_prepaid_rateplan.c

#app_prepaid_rateplan.so: app_prepaid_rateplan.o
	$(CC) -shared -Xlinker -x -o $@ $< -lpq

ifneq ($(wildcard .depend),)
include .depend
endif

depend: .depend

.depend:
	../mkdep $(CFLAGS) `ls *.c`

env:
	env



		
__________________________________ 
Do you Yahoo!? 
Yahoo! Mail - Helps protect you from nasty viruses. 
http://promotions.yahoo.com/new_mail



More information about the asterisk-dev mailing list