# Generated automatically from Makefile.in by configure.
# Columbia InterNet Extensible Multimedia Architecture
#                CINEMA Makefile
# Copyright (c)1998-2000 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
VERSION   := 1.0
DATE      := $(shell \date +%Y%m%d)
SYSNAME   := $(shell uname -srm | sed 's/ /-/g')

topsrcdir := .
topdir    := .



# NT should be before any application target.
# Generic libraries : NT resparse-1.3, libdict
# CINEMA libraries : libcine, libsip, libsip++, libmixer
# CINEMA Tools : tools
# Applications: sipd, rtspd, sip323, v-mail.

CINEMA_MODULES =  NT resparse-1.3 libdict \
                  libcine libsip libsip++ cpl \
		  tools scripts \
                  sipd rtspd

# \
#                  sip323 v-mail sipua \
#                  libmixer sipconf


CFLAGS    := -g -O2 -Wall
CCFLAGS   := @CCFLAGS@
CPPFLAGS  := 
LDFLAGS   := 
LIBS      := -lpthread 
LIBOBJS   := @LIBOBJS@
DEFS      := -DVERSION=\"$(VERSION)\" -DHAVE_CONFIG_H

CC        := gcc
CXX       := c++
AR        := ar
RANLIB    := ranlib

DEPEND    := $(topsrcdir)/aux/depend.sh
MKDIST    := $(topsrcdir)/aux/dist.sh

SOCKLIBS  := -lnsl 
NISLIBS   := -lnsl 
CRYPTLIBS := -lcrypt 
RESOLVLIBS := -lresolv 

USE_DB    := no
DBLIBS    := 

USE_LDAP  := no
LDAPLIBS  := 

USE_PGP_SDK := no
PGP_SDKLIBS := 

HAVE_GETUTENT := yes
HAVE_STRTOK_R := yes
HAVE_ACL := 
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 :=


# Misc files for any source distribution
TOP_DIST := \
        $(topdir)/README \
        $(topdir)/README.build \
	$(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)/aux/config.guess \
	$(topdir)/aux/config.sub \
	$(topdir)/aux/install-sh \
	$(topdir)/aux/depend.sh \
	$(topdir)/aux/dist.sh

# Misc files for any binary distribution
TOP_BINDIST := \
	$(topdir)/README


# 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 $<..."
	$(CC) $(CFLAGS) $(CPPFLAGS) $(DEFS) -c -o $@ $<

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

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

# determine the C include dependencies
DEP := $(OBJ:.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) $(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 available:"
	@echo "    make             Make libcine, libsip, sipd and rtspd."
	@echo "    make sipd        Make SIP server - sipd"
	@echo "    make rtspd       Make RTSP media server - rtspd"
	@echo "    make sip++       Make C++ SIP API Library - libsip++"
	@echo "    make sipua       Make SIP Useragent - sipua"
	@echo "    make v-mail      Make voice mail server - v-mail"
	@echo "    make h323        Make C++ H323 API Library - libh323++"
	@echo "    make sip323      Make SIP-H.323 gateway - sip323"
	@echo "    make clean       Remove temporary files"
	@echo "    make dist        Package source distridution"
	@echo "    make bindist     Package binary distribution"
	@echo "    make distclean   Remove all files which can be re-created"
	@echo "    make cleanh323   Remove temporary files of libh323"
	@echo "    make cleansip323 Remove temporary files of sip323"
	@echo "    make cleanvmail  Remove temporary files of v-mail"

.PHONY: clean distclean


# Phony requirements targets
.PHONY: need-ldap need-pgp need-db need-licensing

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

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

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

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


