#########################################################################
#
#  Targets supported
#  all     - builds everything and installs
#  install - identical to all
#  depend  - build dependencies
#  clean   - clears derived objects except the .depend files
#  distclean- clears all derived objects and the .depend file
#  
# @par
# INTEL CONFIDENTIAL
# Copyright 2009 Intel Corporation All Rights Reserved.
# 
# The source code contained or described herein and all documents related to the
# source code ("Material") are owned by Intel Corporation or its suppliers or
# licensors. Title to the Material remains with Intel Corporation or its
# suppliers and licensors. The Material may contain trade secrets and proprietary
# and confidential information of Intel Corporation and its suppliers and
# licensors, and is protected by worldwide copyright and trade secret laws and
# treaty provisions. No part of the Material may be used, copied, reproduced,
# modified, published, uploaded, posted, transmitted, distributed, or disclosed
# in any way without Intels prior express written permission.
# No license under any patent, copyright, trade secret or other intellectual
# property right is granted to or conferred upon you by disclosure or delivery
# of the Materials, either expressly, by implication, inducement, estoppel or
# otherwise. Any license under such intellectual property rights must be
# express and approved by Intel in writing.
# 
# Include any supplier copyright notices as supplier requires Intel to use.
# Include supplier trademarks or logos as supplier requires Intel to use,
# preceded by an asterisk.
# An asterisked footnote can be added as follows: 
#   *Third Party trademarks are the property of their respective owners.
# 
# Unless otherwise agreed by Intel in writing, you may not remove or alter this
# notice or any other notice embedded in Materials by Intel or Intels suppliers
# or licensors in any way.
# 
#  version: ADS.L.1.1.0-160
############################################################################


####################Common variables and definitions########################
# Ensure The ENV_DIR environmental var is defined.
ifndef ADS_ENV_DIR
$(error ADS_ENV_DIR is undefined. Please set the path to your environment makefile \
        "-> setenv ADS_ENV_DIR <path>")
endif

ifndef ADS_REF_APP
$(error ADS_REF_APP is undefined. Please set it to either "endpoint" or "pbx")
endif

#Add your project environment Makefile
include $(ADS_ENV_DIR)/environment.mk


#include the makefile with all the default and common Make variable definitions
include $(ADS_BUILDSYSTEM_PATH)/build_files/common.mk




#Add the name for the executable, Library or Module output definitions
ifeq ($(ADS_REF_APP),endpoint)
OUTPUT_NAME=adsTelEpApp
endif
ifeq ($(ADS_REF_APP),pbx)
OUTPUT_NAME=adsTelPbxApp
endif
#ifeq ($(OUTPUT_NAME),invalid)
#$(error Please set ADS_REF_APP to either endpoint or pbx")
#endif


# List of Source Files to be compiled (to be in a single line or on different lines separated by a "\" and tab.
SOURCES=  common/adsTelRTP.c \
          common/adsTelFwCb.c \
          common/adsTelAddTone.c \
          common/adsTelUtils.c
          
ifeq ($(ADS_REF_APP),endpoint)
SOURCES+= ipPhone/adsTelEpMain.c \
          ipPhone/adsTelEpMenu.c \
          ipPhone/adsTelEpALSA.c
endif


ifeq ($(ADS_REF_APP),pbx)
SOURCES+= ipPBX/adsTelPbxMain.c \
          ipPBX/adsTelPbxMenu.c 
CFLAGS += -DADS_REF_APP_PBX
endif


#common includes between all supported OSes
INCLUDES= -I include/ \
          -I $(ADS_ORTP_BASE)/include \
          -I $(ADS_INC_DIR) \
          -I $(ADS_INC_DIR)/../src/inc \
          -I $(IPP_API) \
          -I $(IPP_SAMPLE_API)/speech-codecs/core/usc/include \
          -I $(IPP_SAMPLE_API)/speech-codecs/codec/speech/g729i/include \
          -I $(IPP_SAMPLE_API)/speech-codecs/codec/speech/g723.1/include \
          -I $(IPP_SAMPLE_API)/speech-codecs/codec/speech/ec/include

ifdef ADS_SRTP          
INCLUDES+=-I $(ADS_SRTP_BASE)/srtp/include \
          -I $(ADS_SRTP_BASE)/srtp/crypto/include 
endif

ifdef ADS_DEBUG
INCLUDES+= -I ../debugApp/include/
endif


#Additional libraries
ADDITIONAL_OBJECTS+= $(ADS_ORTP_LIB) \
                     -lasound \
                     $(ADS_LIB)\
                     -ldl -lrt \
                     $(ADS_OSAL_LIB) \
                    -L$(IPP_LIBS) -lippsc -lipps -lippsr -lippcore -lguide \
                    -L$(IPP_SAMPLE_LIBS) -lcore -lspeech -lpthread


ifdef ADS_SRTP          
ADDITIONAL_OBJECTS += -L$(ADS_SRTP_LIB)
endif


#include your $(ADS_OS)_$(ADS_OS_LEVEL).mk file
#e.g. include $(ADS_ENV_DIR)/$(ADS_OS)_$(ADS_OS_LEVEL).mk



# On the line directly below list the outputs you wish to build for,
# e.g "lib_static lib_shared exe module" as show below
install: exe 



###################Include rules makefiles########################
include $(ADS_BUILDSYSTEM_PATH)/build_files/rules.mk
###################End of Rules inclusion#########################
