2005-06-02 18:47:35 +00:00
|
|
|
#
|
|
|
|
# (CAPI*)
|
|
|
|
#
|
2006-01-30 23:40:28 +00:00
|
|
|
# An implementation of Common ISDN API 2.0 for
|
|
|
|
# Asterisk/OpenPBX.org
|
2005-06-02 18:47:35 +00:00
|
|
|
#
|
|
|
|
# Makefile, based on the Asterisk Makefile, Coypright (C) 1999, Mark Spencer
|
|
|
|
#
|
2006-01-30 23:40:28 +00:00
|
|
|
# Copyright (C) 2005-2006 Cytronics & Melware
|
2005-06-02 18:47:35 +00:00
|
|
|
#
|
|
|
|
# Armin Schindler <armin@melware.de>
|
|
|
|
#
|
|
|
|
# Reworked, but based on the work of
|
|
|
|
# Copyright (C) 2002-2005 Junghanns.NET GmbH
|
|
|
|
#
|
|
|
|
# Klaus-Peter Junghanns <kapejod@ns1.jnetdns.de>
|
|
|
|
#
|
|
|
|
# This program is free software and may be modified and
|
|
|
|
# distributed under the terms of the GNU Public License.
|
|
|
|
#
|
|
|
|
|
2005-09-10 13:53:22 +00:00
|
|
|
OSNAME=${shell uname}
|
|
|
|
|
2005-06-02 18:47:35 +00:00
|
|
|
.EXPORT_ALL_VARIABLES:
|
|
|
|
|
2006-01-30 23:40:28 +00:00
|
|
|
.PHONY: openpbx
|
|
|
|
|
2005-06-02 18:47:35 +00:00
|
|
|
INSTALL_PREFIX=
|
2005-09-10 13:53:22 +00:00
|
|
|
|
2005-10-01 13:32:58 +00:00
|
|
|
ASTERISK_HEADER_DIR=$(INSTALL_PREFIX)/usr/include
|
|
|
|
|
2005-09-10 13:53:22 +00:00
|
|
|
ifeq (${OSNAME},FreeBSD)
|
|
|
|
ASTERISK_HEADER_DIR=$(INSTALL_PREFIX)/usr/local/include
|
2005-10-01 13:32:58 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq (${OSNAME},NetBSD)
|
|
|
|
ASTERISK_HEADER_DIR=$(INSTALL_PREFIX)/usr/pkg/include
|
2005-09-10 13:53:22 +00:00
|
|
|
endif
|
2005-06-02 18:47:35 +00:00
|
|
|
|
2005-10-01 13:32:58 +00:00
|
|
|
MODULES_DIR=$(INSTALL_PREFIX)/usr/lib/asterisk/modules
|
|
|
|
|
2005-09-10 13:53:22 +00:00
|
|
|
ifeq (${OSNAME},FreeBSD)
|
|
|
|
MODULES_DIR=$(INSTALL_PREFIX)/usr/local/lib/asterisk/modules
|
2005-10-01 13:32:58 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq (${OSNAME},NetBSD)
|
|
|
|
MODULES_DIR=$(INSTALL_PREFIX)/usr/pkg/lib/asterisk/modules
|
2005-09-10 13:53:22 +00:00
|
|
|
endif
|
2005-06-02 18:47:35 +00:00
|
|
|
|
2006-02-14 15:24:34 +00:00
|
|
|
CONFIG_DIR=$(INSTALL_PREFIX)/etc/asterisk
|
|
|
|
|
|
|
|
ifeq (${OSNAME},FreeBSD)
|
|
|
|
CONFIG_DIR=$(INSTALL_PREFIX)/usr/local/etc/asterisk
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq (${OSNAME},NetBSD)
|
|
|
|
CONFIG_DIR=$(INSTALL_PREFIX)/usr/pkg/etc/asterisk
|
|
|
|
endif
|
|
|
|
|
2005-06-02 18:47:35 +00:00
|
|
|
PROC=$(shell uname -m)
|
|
|
|
|
2006-01-28 20:39:59 +00:00
|
|
|
LIBLINUX=
|
2005-06-02 18:47:35 +00:00
|
|
|
DEBUG=-g #-pg
|
|
|
|
INCLUDE=-I$(ASTERISK_HEADER_DIR)
|
2006-01-28 20:39:59 +00:00
|
|
|
ifndef C4B
|
2005-09-10 13:53:22 +00:00
|
|
|
ifeq (${OSNAME},FreeBSD)
|
|
|
|
INCLUDE+=$(shell [ -d /usr/include/i4b/include ] && \
|
|
|
|
echo -n -I/usr/include/i4b/include)
|
|
|
|
endif
|
2005-10-01 13:32:58 +00:00
|
|
|
ifeq (${OSNAME},NetBSD)
|
|
|
|
INCLUDE+=$(shell [ -d /usr/include/i4b/include ] && \
|
|
|
|
echo -n -I/usr/include/i4b/include)
|
|
|
|
endif
|
2006-01-28 20:39:59 +00:00
|
|
|
endif #C4B
|
|
|
|
|
|
|
|
ifdef C4B
|
|
|
|
LIBLINUX=-L/usr/local/lib -llinuxcapi20
|
|
|
|
endif
|
|
|
|
|
2005-08-07 10:27:50 +00:00
|
|
|
CFLAGS=-pipe -fPIC -Wall -Wmissing-prototypes -Wmissing-declarations $(DEBUG) $(INCLUDE) -D_REENTRANT -D_GNU_SOURCE
|
2005-12-27 19:45:27 +00:00
|
|
|
CFLAGS+=$(OPTIMIZE)
|
2005-06-02 18:47:35 +00:00
|
|
|
CFLAGS+=-O6
|
|
|
|
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)
|
|
|
|
|
|
|
|
LIBS=-ldl -lpthread -lm
|
|
|
|
CC=gcc
|
|
|
|
INSTALL=install
|
|
|
|
|
2005-08-21 10:28:43 +00:00
|
|
|
SHAREDOS=chan_capi.so
|
2005-06-02 18:47:35 +00:00
|
|
|
|
2006-01-30 23:40:28 +00:00
|
|
|
OBJECTS=chan_capi.o c20msg.o chan_capi_rtp.o
|
2005-09-11 15:46:46 +00:00
|
|
|
|
2005-06-02 18:47:35 +00:00
|
|
|
CFLAGS+=-Wno-missing-prototypes -Wno-missing-declarations
|
|
|
|
|
|
|
|
CFLAGS+=-DCRYPTO
|
|
|
|
|
|
|
|
all: config.h $(SHAREDOS)
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -f config.h
|
|
|
|
rm -f *.so *.o
|
2006-04-01 12:17:32 +00:00
|
|
|
rm -rf openpbx
|
2005-06-02 18:47:35 +00:00
|
|
|
|
|
|
|
config.h:
|
|
|
|
./create_config.sh "$(ASTERISK_HEADER_DIR)"
|
|
|
|
|
2005-09-11 15:46:46 +00:00
|
|
|
chan_capi.so: $(OBJECTS)
|
2006-01-28 20:39:59 +00:00
|
|
|
$(CC) -shared -Xlinker -x -o $@ $^ $(LIBLINUX) -lcapi20
|
2005-06-02 18:47:35 +00:00
|
|
|
|
|
|
|
install: all
|
2005-12-27 19:45:27 +00:00
|
|
|
$(INSTALL) -d -m 755 $(MODULES_DIR)
|
2005-06-02 18:47:35 +00:00
|
|
|
for x in $(SHAREDOS); do $(INSTALL) -m 755 $$x $(MODULES_DIR) ; done
|
|
|
|
|
2005-12-27 19:45:27 +00:00
|
|
|
install_config: capi.conf
|
2006-02-14 15:24:34 +00:00
|
|
|
$(INSTALL) -d -m 755 ${CONFIG_DIR}
|
|
|
|
$(INSTALL) -m 644 capi.conf ${CONFIG_DIR}
|
2005-06-02 18:47:35 +00:00
|
|
|
|
2005-12-27 19:45:27 +00:00
|
|
|
samples: install_config
|
2005-06-02 18:47:35 +00:00
|
|
|
|
2006-01-30 23:40:28 +00:00
|
|
|
openpbx:
|
|
|
|
@rm -rf openpbx
|
|
|
|
@mkdir -p openpbx/channels
|
|
|
|
@mkdir -p openpbx/include/openpbx
|
|
|
|
@mkdir -p openpbx/doc
|
|
|
|
@mkdir -p openpbx/configs
|
|
|
|
@( \
|
|
|
|
./preparser -c openpbx.ctrl chan_capi.c openpbx/channels/chan_capi.c; \
|
|
|
|
./preparser -c openpbx.ctrl chan_capi_rtp.c openpbx/channels/chan_capi_rtp.c; \
|
|
|
|
./preparser -c openpbx.ctrl c20msg.c openpbx/channels/c20msg.c; \
|
|
|
|
./preparser -c openpbx.ctrl chan_capi.h openpbx/include/openpbx/chan_capi.h; \
|
|
|
|
./preparser -c openpbx.ctrl chan_capi_rtp.h openpbx/include/openpbx/chan_capi_rtp.h; \
|
|
|
|
./preparser -c openpbx.ctrl chan_capi20.h openpbx/include/openpbx/chan_capi20.h; \
|
|
|
|
./preparser -c openpbx.ctrl xlaw.h openpbx/include/openpbx/xlaw.h; \
|
|
|
|
./preparser -c openpbx.ctrl README openpbx/doc/README.chan_capi; \
|
|
|
|
./preparser -c openpbx.ctrl capi.conf openpbx/configs/capi.conf.sample; \
|
|
|
|
true; \
|
|
|
|
)
|
|
|
|
|
|
|
|
|