#
# Makefile for GSM 06.10
#
# Copyright (C) 2004 Post Increment, All Rights Reserved
#
# The contents of this file are subject to the Mozilla Public License
# Version 1.0 (the "License"); you may not use this file except in
# compliance with the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS"
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
# the License for the specific language governing rights and limitations
# under the License.
#
# The Original Code is Open H323 library.
#
# The Initial Developer of the Original Code is Post Increment
#
# Contributor(s): Matthias Schneider.
#

VC_PLUGIN_DIR=@VC_PLUGIN_DIR@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
target_os=@target_os@

DL_LIBS =@DL_LIBS@

BASENAME	=h263-1998
SONAME		=$(BASENAME)
COMMONDIR	=../common
PLUGINDIR	=../../
OBJDIR 		=./obj

CC	 	=@CC@
CFLAGS	 	=@CFLAGS@
CXX	 	=@CXX@
LDSO	 	=@LDSO@
PLUGINEXT	=@PLUGINEXT@
STDCCFLAGS	=@STDCCFLAGS@
LIBAVCODEC_CFLAGS=@LIBAVCODEC_CFLAGS@
LDFLAGS		=@LDFLAGS@
HAVE_LIBAVCODEC_RTP_MODE=@HAVE_LIBAVCODEC_RTP_MODE@

ifdef HAVE_LIBAVCODEC_RTP_MODE
STDCCFLAGS += -DLIBAVCODEC_RTP_MODE=1
endif

ifdef TRACE_FILE
CFLAGS         += -DTRACE_FILE=1
endif

EXTRACCFLAGS    += $(LIBAVCODEC_CFLAGS) -I$(COMMONDIR) -I$(PLUGINDIR)

vpath   %.cxx $(COMMONDIR)
vpath   %.o   $(OBJDIR)

SRCS	+= h263-1998.cxx \
	   h263pframe.cxx \
	   rfc2190.cxx \
	   $(COMMONDIR)/trace.cxx \
	   $(COMMONDIR)/dyna.cxx \
	   $(COMMONDIR)/mpi.cxx

$(OBJDIR)/%.o : %.cxx
	@mkdir -p $(OBJDIR) >/dev/null 2>&1
	$(CXX) -I../../../include $(EXTRACCFLAGS) $(STDCCFLAGS) $(OPTCCFLAGS) $(CFLAGS) -c $< -o $@

PLUGIN	= ./$(BASENAME)_video_pwplugin.$(PLUGINEXT)
STATIC	= ./lib$(BASENAME)_video_s.a

OBJECTS = $(addprefix $(OBJDIR)/,$(patsubst %.cxx,%.o,$(notdir $(SRCS))))

$(PLUGIN): $(OBJECTS)
ifeq (,$(findstring solaris,$(target_os)))
	$(CXX) $(LDSO) $(DL_LIBS) -o $@ $^
else	
	$(CXX) $(LDSO) $(DL_LIBS) $@ -o $@ $^
endif
    
install: $(PLUGIN)
	mkdir -p $(DESTDIR)$(libdir)/$(VC_PLUGIN_DIR)
	install $(PLUGIN) $(DESTDIR)$(libdir)/$(VC_PLUGIN_DIR)

uninstall:
	rm -f $(DESTDIR)$(libdir)/$(VC_PLUGIN_DIR)/$(PLUGIN)

clean:
	rm -f $(OBJECTS) $(PLUGIN)

###########################################
