#################################################################################
#
# Makefile
#
# Makefile for the OpenH323 wrapper library and the ASTERISK channel
# driver module.
#
# Copyright (c) 2002 InAccess Networks
# Michalis Manousos <manousos@inaccessnetworks.com>
# Dimitris Economou <decon@inaccessnetworks.com>
#
# This file is part of "H323 support for ASTERISK"
#
# "H323 support for ASTERISK" 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. 
#
# "H323 support for ASTERISK" 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. 
#
#
#################################################################################

# Export all variables to child processes
.EXPORT_ALL_VARIABLES:

#################################################################################
###### START OF USER CONFIGURABLE PARAMETERS 

#
# Set PWLIBDIR variable to the directory containing the sources of PWlib library.
#
PWLIBDIR=/usr/include/ptlib

#
# Set OPENH323DIR variable to the directory containing the sources of OpenH323
# library.
#
OPENH323DIR=/usr/include/openh323

#
# Normally you should not change PWLIBFLAGS
#
PWLIBFLAGS=-DP_LINUX -D_REENTRANT -DP_HAS_SEMAPHORES -DP_SSL -DP_PTHREADS \
			-DPBYTE_ORDER=PLITTLE_ENDIAN -DPHAS_TEMPLATES

#
# Normally you should not change OPENH323FLAGS
#
OPENH323FLAGS=-O3 -DNDEBUG

#
# Set ASTERISKMODDIR variable to the directory where ASTERISK's modules reside.
#
ASTERISKMODDIR=/usr/lib/asterisk/modules

#
# Set ASTERISKETCDIR variable to the directory where ASTERISK's configuration
# files reside.
#
ASTERISKETCDIR=/etc/asterisk

#
# Set ASTERISKSRCDIR variable to the directory where ASTERISK's source files
# reside.
#
#ASTERISKSRCDIR=/root/src/asterisk/asterisk-ng
ASTERISKSRCDIR=/usr/include/asterisk

#
# Set OH323WRAPLIBDIR variable to the directory where oh323wrap library
# will be installed. You SHOULD add this directory to your 
# LD_LIBRARY_PATH shell variable, or to the /etc/ld.so.conf
# file and run "ldconfig".
#
OH323WRAPLIBDIR=/usr/local/lib

#
# Set WRAPTRACING to 1 to enable debug information from the OpenH323Wrap
# library or to 0 to disable it.
#
WRAPTRACING       := 0
WRAPTRACING_LEVEL := 5

#
# Set WRAPSTAT to 1 to build static wrapper library
#
WRAPSTAT := 0

###### END OF USER CONFIGURABLE PARAMETERS 
#################################################################################

#
# Definition of variables
#
SHELL:= /bin/sh
SUBDIRS=wrapper asterisk-driver
.PHONY: subdirs_all subdir_install subdir_clean $(SUBDIRS)
CC=gcc
CPP=g++
MAKE=make
INSTALL=install
TOUCH=touch
AR=ar
OH323WRAPINCLUDE=-I/usr/include \
				 -I$(PWLIBDIR)/unix \
				 -I$(PWLIBDIR) \
				 -I$(OPENH323DIR) \
				 -I../asterisk-driver
CPPFLAGS=-Wall -mcpu=i586 $(PWLIBFLAGS) $(OPENH323FLAGS)
ASTERISKINCLUDE=-I$(ASTERISKSRCDIR) -I../wrapper
CFLAGS=-Wall -mcpu=i586

#
# Rules
#
all: subdirs_all

install: all subdirs_install

clean: subdirs_clean

subdirs_all:
	for x in $(SUBDIRS); do $(MAKE) -C $$x all || exit 1 ; done

subdirs_install:
	for x in $(SUBDIRS); do $(MAKE) -C $$x install || exit 1 ; done

subdirs_clean:
	for x in $(SUBDIRS); do $(MAKE) -C $$x clean || exit 1 ; done

