# Generated automatically from Makefile.in by configure.
# Columbia InterNet Extensible Multimedia Architecture
#                CINEMA Makefile
# Copyright (c)1998-2001 by Columbia University.
# All rights reserved.

# Experiment: using non-recursive makefiles.  See
# <http://www.canb.auug.org.au/~millerp/rmch/recu-make-cons-harm.html>

NAME      := cinema

# Define version only if not set in env.
# This allows pre-release builds before actually changing
# the version number in the file.
ifndef VERSION
VERSION   := 1.21
endif
DATE      := $(shell \date +%Y%m%d)
SYSNAME   := $(shell uname -srm | sed 's/ /-/g')

topsrcdir := .
topdir    := .



CFLAGS    := -pipe -Wall -W -O2 -DNO_DEBUG
CCFLAGS   := @CCFLAGS@
# removed -fno-exception
CPPFLAGS  := -I$(QPEDIR)/include -I$(QTDIR)/include -DQT_QWS_EBX -DQT_QWS_CUSTOM -DQWS -fno-rtti -Wall 
LDFLAGS   := 
LIBS      := $(SUBLIBS) -L$(QTDIR)/lib -lqpe -lqte -lnsl -lpthread -ldl 
LIBOBJS   := @LIBOBJS@
DEFS      := -DVERSION=\"$(VERSION)\" -DHAVE_CONFIG_H -I$(QPEDIR)/include -I$(QTDIR)/include

JAVA_CLASSPATH =

CC        := arm-linux-gcc
CXX       := arm-linux-g++
REAL_CC   := arm-linux-gcc
REAL_CXX  := arm-linux-g++
LD	  := arm-linux-ld
AR        := arm-linux-ar
RANLIB    := arm-linux-ranlib
LDD       := ldd
MOC       = $(QTDIR)/bin/moc
UIC       = $(QTDIR)/bin/uic

TAR     =       tar -cf
GZIP    =       gzip -9f

# Variables needed by 'make depend'
export CC
export CXX
export REAL_CC
export REAL_CXX

DEPEND    := $(topsrcdir)/auxil/depend.sh
MKDIST    := $(topsrcdir)/auxil/dist.sh
MKDIST_WIN32 := $(topsrcdir)/auxil/dist_win32.sh

SOCKLIBS  := -lnsl 
NISLIBS   := -lnsl 
CRYPTLIBS := -lcrypt 
RESOLVLIBS := -lresolv 
MATHLIBS  := -lm 
# XXX we don't need -lz
ZLIBLIBS  := 

# MySQL library
USE_MYSQL := no
MYSQLLIBS := 
MYSQL_DIR  := 
MYSQL_STATIC_LIB := 
MYSQL_SHARED_LIB := 

# Tcl library
USE_TCL := no
TCLLIBS := 
TCL_DIR := 

# XML library
USE_XERCES_C := no
XERCES_CLIBS := 
XERCES_C_DIR := 

# TLS library
USE_TLS  := no
TLSLIBS  := 
TLS_DIR  := 

# SNMP library
USE_SNMP := no
SNMPLIBS := 
SNMP_DIR := 
KSTATLIBS := 

# Paths for OpenH323 and pwlib.
OPENH323DIR := 
PWLIBDIR    := 
USE_OPENH323 := no
USE_PWLIB   := no

# ENUM library
USE_ENUM    := no
ENUM_DIR    := 
ENUMLIBS    := 

# Java library for JVM
USE_JAVA    := no
JAVA_DIR    := 
JAVALIBS    := 

HAVE_GETUTENT := yes
HAVE_STRTOK_R := yes
HAVE_STRPTIME := yes
HAVE_ACL := no
HAVE_GETHOSTBYNAME_R := yes
HAVE_TIMEGM := yes

DATE    := $(shell \date +%Y%m%d)

DO_LICENSING := no

.PHONY: all

# Avoid five-line-long compile lines filled with -D options.
# XXX: GCC'ism.  Should #include this in sysdep.h instead, but we'd have to
# make sure every file #include's sysdep.h.
CPPFLAGS += -include $(topdir)/config.h

# Makefile modules add to the following variables as needed

# Binaries created for the binary distribution, 
BIN :=

# Files to be compiled
SRC :=

# Header files
HEADERS :=


# NT should be before any application target.
# Generic libraries : NT, resparse-1.3, libdict
# CINEMA libraries : libcine, libsip, libsip++, libmixer, libh323
# CINEMA Tools : tools cpl scripts
# Applications: sipd, rtspd, sip323, sipum (formarly v-mail), sipua, sipconf.
# Misc: is used to build combo-distribution like sipd+sipum+sipconf...
# It must be the last element.

CINEMA_MODULES =  NT resparse-1.3 libdict \
                  libcine libdb++ \
		  librtp libgsm \
		  libsip libcanon libsip++ libsipsnmp cpl \
		  tools scripts web doc sipservlet \
                  sipd rtspd \
                  sipua \
                  libh323 sip323 \
                  libmixer sipconf \
                  librtsp sipum \
                  sipvxml sipstone \
                  misc


# Misc files for any source distribution
TOP_DIST := \
        $(topdir)/README \
        $(topdir)/README.build \
        $(topdir)/install.tcl \
        $(topdir)/run-monitor \
	$(topdir)/configure.in \
	$(topdir)/configure \
	$(topdir)/aclocal.m4 \
	$(topdir)/Makefile.in \
	$(topdir)/config.h.in \
	$(topdir)/acconfig.h \
	$(topdir)/cinema.dsp \
	$(topdir)/cinema.dsw \
	$(topdir)/auxil/config.guess \
	$(topdir)/auxil/config.sub \
	$(topdir)/auxil/install-sh \
	$(topdir)/auxil/depend.sh \
	$(topdir)/auxil/dist.sh \
        $(topdir)/auxil/dist_win32.sh \
        $(topdir)/release_notes/RELEASE-$(VERSION).txt


# Misc files for any binary distribution
TOP_BINDIST := \
	$(topdir)/README \
        $(topdir)/install.tcl \
        $(topdir)/run-monitor \
        $(topdir)/release_notes/RELEASE-$(VERSION).txt


# Misc files to be removed on 'make clean' (typically testing binaries that
# shouldn't go into a binary distribution).
MISCCLEAN :=


# Makefile modules will add to these abstract targets as needed
all:

test:

.PHONY: all


# include the descriptions for each module, if they exist
-include $(patsubst %,$(topsrcdir)/%/module.mk,$(CINEMA_MODULES))

# compile C files
%.o: %.c
	@echo "compiling $<..."
	$(REAL_CC) $(CFLAGS) $($(@D)-CFLAGS) $(CPPFLAGS) $(DEFS) -c -o $@ $<

# compile CPP files
%.o: %.cpp
	@echo "compiling $<..."
	$(REAL_CXX) $(CFLAGS) $($(@D)-CFLAGS) $(CPPFLAGS) $(DEFS) -o $@ -c  $<

# determine the object files
OBJ_C := $(patsubst %.c,%.o,$(filter %.c,$(SRC))) \
       $(patsubst %.cpp,%.o,$(filter %.cpp,$(SRC)))

# compile java files
ifdef JAVA_DIR
%.class: %.java
	@echo "compiling $<..."
	$(JAVA_DIR)/bin/javac -classpath $(JAVA_CLASSPATH) $<

OBJ_J := \
       $(patsubst %.java,%.class,$(filter %.java,$(SRC)))

endif

OBJ   := $(OBJ_C) $(OBJ_J)

# determine the C include dependencies
DEP := $(OBJ_C:.o=.d)

# include the C include dependencies
include $(DEP)

# create the files containing the C include dependencies (and their
# directories)
%.d: %.c
	@echo "dependencies for $<...";
	$(DEPEND) -o $@ $(CFLAGS) $($(@D)-CFLAGS) $(CPPFLAGS) $(DEFS) $<

# create the files containing the C++ include dependencies (and their
# directories)
%.d: %.cpp
	@echo "dependencies for $<...";
	$(DEPEND) -o $@ $(CFLAGS) $($(@D)-CFLAGS) $(CPPFLAGS) $(DEFS) $<

# Targets for cleaning
clean:
	rm -f $(OBJ) $(BIN) $(MISCCLEAN)
	find $(topdir) \( -name 'nohup.out' -o -name 'lint.out' -o \
		 -name 'core' -o -name '*.core' -name '*_pure_*.[oa]' \) \
		-print | xargs rm -f

distclean: clean
	rm -f config.cache config.status config.log config.h Makefile
	rm -f *.tar.gz
	rm -f $(DEP)
	find $(topdir) -name '*~' -print | xargs rm -f

help:
	@echo "The following targets are also available:"
	@echo " make             Make all modules except sip323."
	@echo " make clean       Remove temporary files"
	@echo " make distclean   Remove all files which can be re-created"

.PHONY: clean distclean


# Phony requirements targets
.PHONY: need-licensing need-openh323 need-pwlib need-mysql need-tcl \
	need-xerces-c need-snmp need-enum

need-licensing:
	@if test $(DO_LICENSING) != yes; then \
		echo "This CINEMA option requires licensing to be enabled.  It cannot be run"; \
		echo "otherwise.  Please re-run configure, specifying --enable-licensing."; \
		exit 1; \
	fi

need-openh323:
	@if test $(USE_OPENH323) != yes; then \
		echo "This CINEMA module requires OpenH323.  It cannot be built without"; \
		echo "it.  Please re-run configure, specifying --with-openh323 appropriately."; \
		exit 1; \
	fi

need-pwlib:
	@if test $(USE_PWLIB) != yes; then \
		echo "This CINEMA module requires PWLIB.  It cannot be built without"; \
		echo "it.  Please re-run configure, specifying --with-pwlib appropriately."; \
		exit 1; \
	fi

need-mysql:
	@if test $(USE_MYSQL) != yes -o "x$(MYSQL_DIR)" = "x" ; then \
		echo "This CINEMA module requires MySQL.  It cannot be built without"; \
		echo "it.  Please re-run configure, specifying --with-mysql appropriately."; \
		exit 1; \
	fi

need-tcl:
	@if test $(USE_TCL) != yes -o "x$(TCL_DIR)" = "x" ; then \
		echo "This CINEMA module requires Tcl.  It cannot be built without"; \
		echo "it.  Please re-run configure, specifying --with-tcl appropriately."; \
		exit 1; \
	fi


need-xerces-c:
	@if test $(USE_XERCES_C) != yes -o "x(XERCES_C_DIR)" = "x"; then \
		echo "This CINEMA module requires Xerces-C.  It cannot be built without"; \
		echo "it.  Please re-run configure, specifying --with-xerces appropriately."; \
		exit 1; \
	fi

need-snmp:
	@if test $(USE_SNMP) != yes -o "x$(SNMP_DIR)" = "x" ; then \
		echo "This CINEMA module requires SNMP.  It cannot be built without"; \
		echo "it.  Please re-run configure, specifying --with-snmp appropriately."; \
		exit 1; \
	fi

need-tls:
	@if test $(USE_TLS) != yes -o "x$(TLS_DIR)" = "x" ; then \
		echo "This CINEMA module requires TLS.  It cannot be built without"; \
		echo "it.  Please re-run configure, specifying --with-tls appropriately."; \
		exit 1; \
	fi

need-enum:
	@if test $(USE_ENUM) != yes -o "x$(ENUM_DIR)" = "x" ; then \
		echo "This CINEMA module requires ENUM.  It cannot be built without"; \
		echo "it.  Please re-run configure, specifying --with-enum appropriately."; \
		exit 1; \
	fi

need-java:
	@if test $(USE_JAVA) != yes -o "x$(JAVA_DIR)" = "x" ; then \
		echo "This CINEMA module requires JAVA.  It cannot be built without"; \
		echo "it.  Please re-run configure, specifying --with-java appropriately."; \
		exit 1; \
	fi
