2001-05-13 00:57:53 +08:00
|
|
|
#
|
|
|
|
# libpri: An implementation of Primary Rate ISDN
|
|
|
|
#
|
|
|
|
# Written by Mark Spencer <markster@linux-support.net>
|
|
|
|
#
|
|
|
|
# Copyright (C) 2001, Linux Support Services, Inc.
|
|
|
|
# All Rights Reserved.
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
#
|
2003-07-08 07:37:18 +08:00
|
|
|
#
|
|
|
|
# Uncomment if you want libpri not send PROGRESS_INDICATOR w/ALERTING
|
|
|
|
#ALERTING=-DALERTING_NO_PROGRESS
|
|
|
|
|
2004-03-15 13:53:25 +08:00
|
|
|
# Uncomment if you want libpri to count number of Q921/Q931 sent/received
|
|
|
|
#LIBPRI_COUNTERS=-DLIBPRI_COUNTERS
|
|
|
|
|
2004-12-16 04:15:28 +08:00
|
|
|
CC=gcc
|
2008-05-03 04:21:04 +08:00
|
|
|
GREP=grep
|
|
|
|
AWK=awk
|
2004-12-16 04:15:28 +08:00
|
|
|
|
2004-05-22 12:25:53 +08:00
|
|
|
OSARCH=$(shell uname -s)
|
2005-09-26 23:57:23 +08:00
|
|
|
PROC?=$(shell uname -m)
|
2004-05-22 12:25:53 +08:00
|
|
|
|
2008-05-08 03:51:44 +08:00
|
|
|
# SONAME version; should be changed on every ABI change
|
|
|
|
# please don't change it needlessly; it's perfectly fine to have a SONAME
|
|
|
|
# of 1.2 and a version of 1.4.x
|
|
|
|
SONAME:=1.4
|
|
|
|
|
2001-05-13 00:57:53 +08:00
|
|
|
STATIC_LIBRARY=libpri.a
|
2008-05-08 03:51:44 +08:00
|
|
|
DYNAMIC_LIBRARY:=libpri.so.$(SONAME)
|
2009-04-22 06:08:45 +08:00
|
|
|
STATIC_OBJS= \
|
|
|
|
copy_string.o \
|
|
|
|
pri.o \
|
|
|
|
q921.o \
|
|
|
|
prisched.o \
|
|
|
|
q931.o \
|
2010-05-29 02:03:38 +08:00
|
|
|
pri_aoc.o \
|
2010-05-27 00:01:10 +08:00
|
|
|
pri_cc.o \
|
2009-04-22 06:08:45 +08:00
|
|
|
pri_facility.o \
|
|
|
|
asn1_primitive.o \
|
|
|
|
rose.o \
|
|
|
|
rose_address.o \
|
|
|
|
rose_etsi_aoc.o \
|
2010-05-27 00:01:10 +08:00
|
|
|
rose_etsi_cc.o \
|
2009-08-19 07:53:32 +08:00
|
|
|
rose_etsi_diversion.o \
|
|
|
|
rose_etsi_ect.o \
|
2010-05-29 05:50:14 +08:00
|
|
|
rose_etsi_mwi.o \
|
2009-04-22 06:08:45 +08:00
|
|
|
rose_other.o \
|
|
|
|
rose_q931.o \
|
2009-04-22 07:32:13 +08:00
|
|
|
rose_qsig_aoc.o \
|
2010-05-27 00:01:10 +08:00
|
|
|
rose_qsig_cc.o \
|
2009-04-22 06:08:45 +08:00
|
|
|
rose_qsig_ct.o \
|
|
|
|
rose_qsig_diversion.o \
|
|
|
|
rose_qsig_mwi.o \
|
|
|
|
rose_qsig_name.o \
|
|
|
|
version.o
|
|
|
|
DYNAMIC_OBJS= \
|
|
|
|
copy_string.lo \
|
|
|
|
pri.lo \
|
|
|
|
q921.lo \
|
|
|
|
prisched.lo \
|
|
|
|
q931.lo \
|
2010-05-29 02:03:38 +08:00
|
|
|
pri_aoc.lo \
|
2010-05-27 00:01:10 +08:00
|
|
|
pri_cc.lo \
|
2009-04-22 06:08:45 +08:00
|
|
|
pri_facility.lo \
|
|
|
|
asn1_primitive.lo \
|
|
|
|
rose.lo \
|
|
|
|
rose_address.lo \
|
|
|
|
rose_etsi_aoc.lo \
|
2010-05-27 00:01:10 +08:00
|
|
|
rose_etsi_cc.lo \
|
2009-08-19 07:53:32 +08:00
|
|
|
rose_etsi_diversion.lo \
|
|
|
|
rose_etsi_ect.lo \
|
2010-05-29 05:50:14 +08:00
|
|
|
rose_etsi_mwi.lo \
|
2009-04-22 06:08:45 +08:00
|
|
|
rose_other.lo \
|
|
|
|
rose_q931.lo \
|
2009-04-22 07:32:13 +08:00
|
|
|
rose_qsig_aoc.lo \
|
2010-05-27 00:01:10 +08:00
|
|
|
rose_qsig_cc.lo \
|
2009-04-22 06:08:45 +08:00
|
|
|
rose_qsig_ct.lo \
|
|
|
|
rose_qsig_diversion.lo \
|
|
|
|
rose_qsig_mwi.lo \
|
|
|
|
rose_qsig_name.lo \
|
|
|
|
version.lo
|
2009-08-19 04:59:32 +08:00
|
|
|
CFLAGS=-Wall -Werror -Wstrict-prototypes -Wmissing-prototypes -g -fPIC $(ALERTING) $(LIBPRI_COUNTERS) $(LIBPRI_OPT)
|
2006-04-04 23:34:35 +08:00
|
|
|
INSTALL_PREFIX=$(DESTDIR)
|
2004-12-16 04:15:28 +08:00
|
|
|
INSTALL_BASE=/usr
|
2008-08-07 02:20:51 +08:00
|
|
|
libdir?=$(INSTALL_BASE)/lib
|
2008-05-08 03:51:44 +08:00
|
|
|
SOFLAGS:=-Wl,-h$(DYNAMIC_LIBRARY)
|
2005-08-30 03:12:31 +08:00
|
|
|
LDCONFIG = /sbin/ldconfig
|
2009-08-22 03:51:40 +08:00
|
|
|
ifneq (,$(findstring X$(OSARCH)X, XLinuxX XGNU/kFreeBSDX XGNUX))
|
2004-05-22 12:25:53 +08:00
|
|
|
LDCONFIG_FLAGS=-n
|
|
|
|
else
|
|
|
|
ifeq (${OSARCH},FreeBSD)
|
|
|
|
LDCONFIG_FLAGS=-m
|
|
|
|
CFLAGS += -I../zaptel -I../zapata
|
2006-05-09 16:15:51 +08:00
|
|
|
INSTALL_BASE=/usr/local
|
2004-05-22 12:25:53 +08:00
|
|
|
endif
|
|
|
|
endif
|
2004-12-16 04:15:28 +08:00
|
|
|
ifeq (${OSARCH},SunOS)
|
2005-08-30 03:12:31 +08:00
|
|
|
CFLAGS += -DSOLARIS -I../zaptel-solaris
|
|
|
|
LDCONFIG =
|
|
|
|
LDCONFIG_FLAGS = \# # Trick to comment out the period in the command below
|
|
|
|
#INSTALL_PREFIX = /opt/asterisk # Uncomment out to install in standard Solaris location for 3rd party code
|
2004-12-16 04:15:28 +08:00
|
|
|
endif
|
2001-05-13 00:57:53 +08:00
|
|
|
|
2008-05-03 04:21:04 +08:00
|
|
|
export PRIVERSION
|
|
|
|
|
|
|
|
PRIVERSION:=$(shell GREP=$(GREP) AWK=$(AWK) build_tools/make_version .)
|
|
|
|
|
2004-09-01 01:40:59 +08: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 doesnt support it.
|
|
|
|
ifeq ($(PROC),sparc64)
|
|
|
|
PROC=ultrasparc
|
2009-08-19 04:59:32 +08:00
|
|
|
LIBPRI_OPT = -mtune=$(PROC) -O3 -pipe -fomit-frame-pointer -mcpu=v8
|
|
|
|
else
|
|
|
|
LIBPRI_OPT = -O2
|
2004-09-01 01:40:59 +08:00
|
|
|
endif
|
|
|
|
|
2010-02-12 01:35:49 +08:00
|
|
|
ifeq ($(CPUARCH),i686)
|
|
|
|
CFLAGS += -m32
|
|
|
|
SOFLAGS += -m32
|
|
|
|
endif
|
|
|
|
|
2008-07-30 23:39:37 +08:00
|
|
|
all: $(STATIC_LIBRARY) $(DYNAMIC_LIBRARY)
|
2001-05-13 00:57:53 +08:00
|
|
|
|
2004-01-27 08:39:59 +08:00
|
|
|
update:
|
2005-12-02 08:57:34 +08:00
|
|
|
@if [ -d .svn ]; then \
|
|
|
|
echo "Updating from Subversion..." ; \
|
2008-05-08 03:51:44 +08:00
|
|
|
fromrev="`svn info | $(AWK) '/Revision: / {print $$2}'`"; \
|
|
|
|
svn update | tee update.out; \
|
|
|
|
torev="`svn info | $(AWK) '/Revision: / {print $$2}'`"; \
|
|
|
|
echo "`date` Updated from revision $${fromrev} to $${torev}." >> update.log; \
|
|
|
|
rm -f .version; \
|
|
|
|
if [ `grep -c ^C update.out` -gt 0 ]; then \
|
|
|
|
echo ; echo "The following files have conflicts:" ; \
|
|
|
|
grep ^C update.out | cut -b4- ; \
|
|
|
|
fi ; \
|
|
|
|
rm -f update.out; \
|
2005-01-09 09:18:22 +08:00
|
|
|
else \
|
2005-12-02 08:57:34 +08:00
|
|
|
echo "Not under version control"; \
|
2005-01-09 09:18:22 +08:00
|
|
|
fi
|
2004-01-27 08:39:59 +08:00
|
|
|
|
2001-05-13 00:57:53 +08:00
|
|
|
install: $(STATIC_LIBRARY) $(DYNAMIC_LIBRARY)
|
2008-08-07 02:20:51 +08:00
|
|
|
mkdir -p $(INSTALL_PREFIX)$(libdir)
|
2005-08-30 03:12:31 +08:00
|
|
|
mkdir -p $(INSTALL_PREFIX)$(INSTALL_BASE)/include
|
|
|
|
ifneq (${OSARCH},SunOS)
|
|
|
|
install -m 644 libpri.h $(INSTALL_PREFIX)$(INSTALL_BASE)/include
|
2008-08-07 02:20:51 +08:00
|
|
|
install -m 755 $(DYNAMIC_LIBRARY) $(INSTALL_PREFIX)$(libdir)
|
2010-01-14 03:37:59 +08:00
|
|
|
#if [ -x /usr/sbin/sestatus ] && ( /usr/sbin/sestatus | grep "SELinux status:" | grep -q "enabled"); then /sbin/restorecon -v $(INSTALL_PREFIX)$(libdir)/$(DYNAMIC_LIBRARY); fi
|
2008-08-07 02:20:51 +08:00
|
|
|
( cd $(INSTALL_PREFIX)$(libdir) ; ln -sf libpri.so.$(SONAME) libpri.so)
|
|
|
|
install -m 644 $(STATIC_LIBRARY) $(INSTALL_PREFIX)$(libdir)
|
|
|
|
if test $$(id -u) = 0; then $(LDCONFIG) $(LDCONFIG_FLAGS) $(INSTALL_PREFIX)$(libdir); fi
|
2005-08-30 03:12:31 +08:00
|
|
|
else
|
|
|
|
install -f $(INSTALL_PREFIX)$(INSTALL_BASE)/include -m 644 libpri.h
|
2008-08-07 02:20:51 +08:00
|
|
|
install -f $(INSTALL_PREFIX)$(libdir) -m 755 $(DYNAMIC_LIBRARY)
|
|
|
|
( cd $(INSTALL_PREFIX)$(libdir) ; ln -sf libpri.so.$(SONAME) libpri.so)
|
|
|
|
install -f $(INSTALL_PREFIX)$(libdir) -m 644 $(STATIC_LIBRARY)
|
2005-08-30 03:12:31 +08:00
|
|
|
endif
|
2001-05-13 00:57:53 +08:00
|
|
|
|
2004-02-02 13:55:03 +08:00
|
|
|
uninstall:
|
|
|
|
@echo "Removing Libpri"
|
2008-08-07 02:20:51 +08:00
|
|
|
rm -f $(INSTALL_PREFIX)$(libdir)/libpri.so.$(SONAME)
|
|
|
|
rm -f $(INSTALL_PREFIX)$(libdir)/libpri.so
|
|
|
|
rm -f $(INSTALL_PREFIX)$(libdir)/libpri.a
|
2005-08-30 03:12:31 +08:00
|
|
|
rm -f $(INSTALL_PREFIX)$(INSTALL_BASE)/include/libpri.h
|
2004-02-02 13:55:03 +08:00
|
|
|
|
2002-03-16 06:52:37 +08:00
|
|
|
pritest: pritest.o
|
2010-07-17 06:55:15 +08:00
|
|
|
$(CC) -o pritest pritest.o -L. -lpri $(CFLAGS)
|
2002-03-16 06:52:37 +08:00
|
|
|
|
2004-03-29 16:09:01 +08:00
|
|
|
testprilib.o: testprilib.c
|
|
|
|
$(CC) $(CFLAGS) -D_REENTRANT -D_GNU_SOURCE -o $@ -c $<
|
|
|
|
|
|
|
|
testprilib: testprilib.o
|
2004-09-01 01:40:59 +08:00
|
|
|
$(CC) -o testprilib testprilib.o -L. -lpri -lpthread $(CFLAGS)
|
2004-03-29 16:09:01 +08:00
|
|
|
|
2002-03-16 06:52:37 +08:00
|
|
|
pridump: pridump.o
|
2005-07-27 21:14:05 +08:00
|
|
|
$(CC) -o pridump pridump.o -L. -lpri $(CFLAGS)
|
2002-03-16 06:52:37 +08:00
|
|
|
|
2009-04-22 06:08:45 +08:00
|
|
|
rosetest: rosetest.o
|
|
|
|
$(CC) -o rosetest rosetest.o -L. -lpri $(CFLAGS)
|
|
|
|
|
2008-07-30 23:39:37 +08:00
|
|
|
MAKE_DEPS= -MD -MT $@ -MF .$(subst /,_,$@).d -MP
|
|
|
|
|
|
|
|
%.o: %.c
|
|
|
|
$(CC) $(CFLAGS) $(MAKE_DEPS) -c -o $@ $<
|
2004-03-31 04:18:12 +08:00
|
|
|
|
2008-07-30 23:39:37 +08:00
|
|
|
%.lo: %.c
|
|
|
|
$(CC) $(CFLAGS) $(MAKE_DEPS) -c -o $@ $<
|
2001-05-13 00:57:53 +08:00
|
|
|
|
|
|
|
$(STATIC_LIBRARY): $(STATIC_OBJS)
|
|
|
|
ar rcs $(STATIC_LIBRARY) $(STATIC_OBJS)
|
|
|
|
ranlib $(STATIC_LIBRARY)
|
|
|
|
|
|
|
|
$(DYNAMIC_LIBRARY): $(DYNAMIC_OBJS)
|
2004-12-16 04:15:28 +08:00
|
|
|
$(CC) -shared $(SOFLAGS) -o $@ $(DYNAMIC_OBJS)
|
|
|
|
$(LDCONFIG) $(LDCONFIG_FLAGS) .
|
2008-05-08 03:51:44 +08:00
|
|
|
ln -sf libpri.so.$(SONAME) libpri.so
|
2001-05-13 00:57:53 +08:00
|
|
|
|
2008-07-30 23:39:37 +08:00
|
|
|
version.c: FORCE
|
2008-05-03 04:21:04 +08:00
|
|
|
@build_tools/make_version_c > $@.tmp
|
|
|
|
@cmp -s $@.tmp $@ || mv $@.tmp $@
|
|
|
|
@rm -f $@.tmp
|
|
|
|
|
2001-05-13 00:57:53 +08:00
|
|
|
clean:
|
2008-05-08 03:51:44 +08:00
|
|
|
rm -f *.o *.so *.lo *.so.$(SONAME)
|
2006-07-06 00:17:05 +08:00
|
|
|
rm -f testprilib $(STATIC_LIBRARY) $(DYNAMIC_LIBRARY)
|
2002-03-16 06:52:37 +08:00
|
|
|
rm -f pritest pridump
|
2008-07-30 23:39:37 +08:00
|
|
|
rm -f .*.d
|
2004-03-31 04:18:12 +08:00
|
|
|
|
2008-07-30 23:39:37 +08:00
|
|
|
.PHONY:
|
2004-03-31 04:18:12 +08:00
|
|
|
|
2008-07-30 23:39:37 +08:00
|
|
|
FORCE:
|
2008-05-03 04:21:04 +08:00
|
|
|
|
2008-07-30 23:39:37 +08:00
|
|
|
ifneq ($(wildcard .*.d),)
|
|
|
|
include .*.d
|
|
|
|
endif
|