#####################################################################################
# Copyright  2005, Intel Corporation. 
# All rights reserved All names, products, and services mentioned  
# herein are the trademarks or registered trademarks of their respective 
# organizations and are the sole property of their respective owners
#####################################################################################

# If no configuration is specified
# force CFG to be Release if build installed, or Internal otherwise

ifdef INTEL_DIALOGIC_BIN
CFG 	=	External
else
CFG 	=	Internal
endif

ifeq "$(OS)" "windows"
all:
	msdev ..\src\ConferencingDemo.dsw "ConferencingDemo - Win32 Release" /MAKE
clean:
	rm ..\src\Release\ConferencingDemo.exe
                                                                                                                             
else


#####################################################################################
# Configuration: External
#####################################################################################
ifeq "$(CFG)" "External"

# If the Dialogic Environment variable has been set, use it
ifdef INTEL_DIALOGIC_INC
	CFG_INC = 	-I$(INTEL_DIALOGIC_INC)
else
	CFG_INC = 	-I/usr/dialogic/inc
endif

ifdef INTEL_DIALOGIC_LIB
        CFG_LIB = 	-L$(INTEL_DIALOGIC_LIB)
else
        CFG_LIB = 	-L/usr/dialogic/lib
endif

# Initialize other variables
OUTDIR          =       ./Release
OBJDIR		=	$(OUTDIR)
OUTFILE         =       $(OUTDIR)/ConferencingDemo

LIB		=	-lcurses 			\
			-lsrl 				\
			-ldxxx 				\
			-ldti 				\
			-lgc				\
			-lipm			

OBJ 		= 	$(OBJDIR)/AppLog.o 		\
	     		$(OBJDIR)/Conference.o    	\
			$(OBJDIR)/ConfManager.o		\
			$(OBJDIR)/IpDev.o 		\
			$(OBJDIR)/main.o 		\
			$(OBJDIR)/newscrn.o  		\
			$(OBJDIR)/utils.o 		\
			$(OBJDIR)/ConferencingDemo_version.o

COMPILE		=	g++ -c   -o "$(OUTDIR)/$(*F).o" $(CFG_INC) "$<"
LINK		=	g++ -o "$(OUTFILE)" $(OBJ) $(CFG_LIB) $(LIB)

# Pattern rules
$(OUTDIR)/%.o : %.cpp
	$(COMPILE)
# Build rules
all: $(OUTFILE)

$(OUTFILE): $(OUTDIR) $(OBJ)
	$(LINK)

# Create the release dir if doesn't exist
$(OUTDIR):
	mkdir -p "$(OUTDIR)"

# Rebuild this project
rebuild: cleanall all

# Clean this project
clean:
	rm -f $(OUTFILE)
	rm -f $(OBJ)

# Clean this project and all dependencies
cleanall: clean
endif

##################################################################################
# Configuration: Internal
##################################################################################
ifeq "$(CFG)" "Internal"
top_reldir	=	../../../..
-include ./make.rules.mak


OUTDIR          =       $(CONFERENCINGDEMO_OBJECTS)
OBJDIR		=	$(CONFERENCINGDEMO_OBJECTS)
OUTFILE         =       $(OUTDIR)/ConferencingDemo
CFG_INC		=	-I$(CONFERENCINGDEMO_INC_EXT) -I$(IPDEMOS_IMPORT_INC)
CFG_LIB		=	-L$(IPDEMOS_IMPORT_LIB)
LIB		=	-lcurses			 	\
			-lsrl 					\
			-ldxxx 					\
			-ldti 					\
			-lgc	 				\
			-lipm		

OBJ 		=	$(OBJDIR)/AppLog.o	    	\
	     		$(OBJDIR)/ConfManager.o    	\
			$(OBJDIR)/Conference.o    	\
			$(OBJDIR)/IpDev.o 		\
			$(OBJDIR)/main.o 		\
			$(OBJDIR)/newscrn.o  		\
			$(OBJDIR)/utils.o		\
			$(OBJDIR)/ConferencingDemo_version.o

COMPILE		=	g++ -c   -o "$(OBJDIR)/$(*F).o" $(CFG_INC) "$<"
LINK		=	g++ -o "$(OUTFILE)" $(OBJ) $(CFG_LIB) $(LIB)

# Pattern rules
$(CONFERENCINGDEMO_OBJECTS)/%.o :$(CONFERENCINGDEMO_SRC)/%.cpp
	$(COMPILE)

# Build rules
all: $(OUTFILE)

$(OUTFILE): $(OUTDIR) $(OBJ)
	 $(LINK)

# Create the release dir if doesn't exist
$(OUTDIR):
	mkdir -p "$(OUTDIR)"


# Rebuild this project
rebuild: cleanall all


# Clean this project
clean:
	rm -f $(OUTFILE)
	rm -f $(OBJ)
        

endif

endif
