2001-10-17 15:04:18 +00:00
|
|
|
#
|
|
|
|
# Asterisk -- A telephony toolkit for Linux.
|
|
|
|
#
|
|
|
|
# Makefile for CDR backends (dynamically loaded)
|
|
|
|
#
|
2005-06-20 17:26:08 +00:00
|
|
|
# Copyright (C) 1999-2005, Digium
|
2001-10-17 15:04:18 +00:00
|
|
|
#
|
2005-06-20 17:26:08 +00:00
|
|
|
# Mark Spencer <markster@digium.com>
|
2001-10-17 15:04:18 +00:00
|
|
|
#
|
|
|
|
# This program is free software, distributed under the terms of
|
|
|
|
# the GNU General Public License
|
|
|
|
#
|
|
|
|
|
2005-03-24 21:57:42 +00:00
|
|
|
MODS=cdr_csv.so cdr_manager.so cdr_custom.so
|
2004-01-08 00:06:35 +00:00
|
|
|
|
2005-11-01 21:53:30 +00:00
|
|
|
ifeq (${OSARCH},CYGWIN)
|
|
|
|
CYGSOLINK=-Wl,--out-implib=lib$@.a -Wl,--export-all-symbols
|
|
|
|
CYGSOLIB=-L.. -L. -lasterisk.dll
|
|
|
|
else
|
2003-04-27 18:13:11 +00:00
|
|
|
CFLAGS+=-fPIC
|
2005-11-01 21:53:30 +00:00
|
|
|
endif
|
2001-10-17 15:04:18 +00:00
|
|
|
|
2005-08-30 02:54:02 +00:00
|
|
|
ifeq ($(findstring BSD,${OSARCH}),BSD)
|
2005-11-14 00:45:07 +00:00
|
|
|
CFLAGS+=-I$(CROSS_COMPILE_TARGET)/usr/local/include
|
|
|
|
SOLINK+=-L$(CROSS_COMPILE_TARGET)/usr/local/lib
|
2004-05-31 19:40:23 +00:00
|
|
|
endif
|
|
|
|
|
2004-08-31 16:33:00 +00:00
|
|
|
#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.
|
|
|
|
#A ultrasparc cpu is really v9 but the stock debian stable 3.0 gcc doesn.t support it.
|
|
|
|
#So we go lowest common available by gcc and go a step down, still a step up from
|
|
|
|
#the default as we now have a better instruction set to work with. - Belgarath
|
|
|
|
ifeq ($(PROC),sparc64)
|
2005-08-30 02:54:02 +00:00
|
|
|
PROC=ultrasparc
|
|
|
|
CFLAGS += -mtune=$(PROC) -O3 -pipe -fomit-frame-pointer -mcpu=v8
|
2004-08-31 16:33:00 +00:00
|
|
|
endif
|
|
|
|
|
2003-12-02 00:21:53 +00:00
|
|
|
#
|
|
|
|
# unixODBC stuff...
|
|
|
|
#
|
2005-08-30 02:54:02 +00:00
|
|
|
ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/odbcinst.h)$(wildcard $(CROSS_COMPILE_TARGET)/usr/local/include/odbcinst.h),)
|
|
|
|
MODS+=cdr_odbc.so
|
|
|
|
endif
|
2003-12-02 00:21:53 +00:00
|
|
|
|
2004-07-23 17:34:57 +00:00
|
|
|
#
|
|
|
|
# FreeTDS stuff...
|
|
|
|
#
|
2005-08-30 02:54:02 +00:00
|
|
|
ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/tds.h)$(wildcard $(CROSS_COMPILE_TARGET)/usr/local/include/tds.h),)
|
2005-10-29 18:49:25 +00:00
|
|
|
ifeq ($(shell grep -s TDS_VERSION_NO $(CROSS_COMPILE_TARGET)/usr/include/tdsver.h $(CROSS_COMPILE_TARGET)/usr/local/include/tdsver.h | grep -c 0.63),1)
|
|
|
|
CFLAGS += -DFREETDS_0_63
|
|
|
|
else
|
|
|
|
ifeq ($(shell grep -s TDS_VERSION_NO $(CROSS_COMPILE_TARGET)/usr/include/tdsver.h $(CROSS_COMPILE_TARGET)/usr/local/include/tdsver.h | grep -c 0.62),1)
|
|
|
|
CFLAGS += -DFREETDS_0_62
|
|
|
|
else
|
|
|
|
CFLAGS += -DFREETDS_PRE_0_62
|
|
|
|
endif
|
|
|
|
endif
|
2005-08-30 02:54:02 +00:00
|
|
|
MODS+=cdr_tds.so
|
|
|
|
endif
|
2004-07-23 17:34:57 +00:00
|
|
|
|
2003-10-01 15:03:30 +00:00
|
|
|
#
|
2003-11-01 11:26:28 +00:00
|
|
|
# PGSQL stuff... Autoconf anyone??
|
2003-10-01 15:03:30 +00:00
|
|
|
#
|
2005-08-30 15:59:25 +00:00
|
|
|
ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/postgresql)$(wildcard $(CROSS_COMPILE_TARGET)/usr/local/pgsql/include)$(wildcard $(CROSS_COMPILE_TARGET)/usr/include/pgsql)$(wildcard $(CROSS_COMPILE_TARGET)/usr/local/include/pgsql)$(wildcard $(CROSS_COMPILE_TARGET)/opt/pgsql/include)$(wildcard $(CROSS_COMPILE_TARGET)/usr/include/libpq-fe.h),)
|
2005-08-30 02:54:02 +00:00
|
|
|
MODS+=cdr_pgsql.so
|
|
|
|
endif
|
|
|
|
|
2003-10-01 15:03:30 +00:00
|
|
|
MLFLAGS=
|
2005-08-30 02:54:02 +00:00
|
|
|
|
2005-08-30 15:59:25 +00:00
|
|
|
ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/postgresql),)
|
|
|
|
CFLAGS+=-I$(CROSS_COMPILE_TARGET)/usr/include/postgresql
|
|
|
|
MLFLAGS+=-L$(CROSS_COMPILE_TARGET)/usr/lib/postgresql
|
|
|
|
endif
|
|
|
|
|
2005-08-30 02:54:02 +00:00
|
|
|
ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/local/pgsql/include),)
|
|
|
|
CFLAGS+=-I$(CROSS_COMPILE_TARGET)/usr/local/pgsql/include
|
|
|
|
MLFLAGS+=-L$(CROSS_COMPILE_TARGET)/usr/local/pgsql/lib
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/pgsql),)
|
|
|
|
CFLAGS+=-I$(CROSS_COMPILE_TARGET)/usr/include/pgsql
|
|
|
|
MLFLAGS+=-L$(CROSS_COMPILE_TARGET)/usr/lib/pgsql
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/local/include/pgsql),)
|
|
|
|
CFLAGS+=-I$(CROSS_COMPILE_TARGET)/usr/local/include/pgsql
|
|
|
|
MLFLAGS+=-L$(CROSS_COMPILE_TARGET)/usr/local/lib/pgsql
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/opt/pgsql/include),)
|
|
|
|
CFLAGS+=-I$(CROSS_COMPILE_TARGET)/opt/pgsql/include
|
|
|
|
MLFLAGS+=-L$(CROSS_COMPILE_TARGET) /opt/pgsql/lib
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifneq ($(wilcard $(CROSS_COMPILE_TARGET)/usr/include/postgresql),)
|
|
|
|
CFLAGS+=-I$(CROSS_COMPILE_TARGET)/usr/include/postgresql
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifneq ($(wilcard $(CROSS_COMPILE_TARGET)/usr/lib/libpq.so),)
|
|
|
|
MLFLAGS+=-L$(CROSS_COMPILE_TARGET)/usr/lib
|
|
|
|
endif
|
2002-06-28 18:46:01 +00:00
|
|
|
|
2004-07-08 08:29:26 +00:00
|
|
|
#
|
2005-08-30 02:54:02 +00:00
|
|
|
# SQLite stuff...
|
2004-07-08 08:29:26 +00:00
|
|
|
#
|
2005-08-30 02:54:02 +00:00
|
|
|
ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/sqlite.h),)
|
|
|
|
MODS+=cdr_sqlite.so
|
|
|
|
endif
|
2004-07-08 08:29:26 +00:00
|
|
|
|
2003-05-06 00:00:20 +00:00
|
|
|
all: depend $(MODS)
|
2001-10-17 15:04:18 +00:00
|
|
|
|
|
|
|
install: all
|
2003-10-25 17:27:53 +00:00
|
|
|
for x in $(MODS); do $(INSTALL) -m 755 $$x $(DESTDIR)$(MODULES_DIR) ; done
|
2001-10-17 15:04:18 +00:00
|
|
|
|
|
|
|
clean:
|
2003-05-06 00:00:20 +00:00
|
|
|
rm -f *.so *.o .depend
|
2001-10-17 15:04:18 +00:00
|
|
|
|
|
|
|
%.so : %.o
|
2005-11-01 21:53:30 +00:00
|
|
|
$(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB}
|
2002-06-28 18:46:01 +00:00
|
|
|
|
2003-08-19 16:42:30 +00:00
|
|
|
ifneq ($(wildcard .depend),)
|
2005-08-30 02:54:02 +00:00
|
|
|
include .depend
|
2003-08-19 16:42:30 +00:00
|
|
|
endif
|
2003-05-06 00:00:20 +00:00
|
|
|
|
2003-12-06 23:19:22 +00:00
|
|
|
cdr_odbc.so: cdr_odbc.o
|
2005-11-01 21:53:30 +00:00
|
|
|
$(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB} -lodbc $(MLFLAGS)
|
2003-12-02 00:21:53 +00:00
|
|
|
|
2004-07-23 17:34:57 +00:00
|
|
|
cdr_tds.so: cdr_tds.o
|
2005-11-01 21:53:30 +00:00
|
|
|
$(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB} -ltds $(MLFLAGS)
|
2004-07-23 17:34:57 +00:00
|
|
|
|
2003-10-01 15:03:30 +00:00
|
|
|
cdr_pgsql.so: cdr_pgsql.o
|
2005-11-01 21:53:30 +00:00
|
|
|
$(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB} -lpq -lz $(MLFLAGS)
|
2003-10-01 15:03:30 +00:00
|
|
|
|
2004-07-08 08:29:26 +00:00
|
|
|
cdr_sqlite.so: cdr_sqlite.o
|
2005-11-01 21:53:30 +00:00
|
|
|
$(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB} -lsqlite $(MLFLAGS)
|
2004-07-08 08:29:26 +00:00
|
|
|
|
2003-05-06 00:00:20 +00:00
|
|
|
depend: .depend
|
|
|
|
|
|
|
|
.depend:
|
2005-06-20 17:26:08 +00:00
|
|
|
../build_tools/mkdep $(CFLAGS) `ls *.c`
|