#
# Makefile for fax codec plugin
#
# Copyright (C) 2007 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): ______________________________________.
#
# $Log: Makefile.in,v $
# Revision 1.5  2007/09/05 11:52:56  csoutheren
# Fix compilation on MacOSX
#
# Revision 1.4  2007/07/19 03:47:08  csoutheren
# Fixed on Linux
#
# Revision 1.3  2007/07/16 06:49:54  csoutheren
# Make sure spanDSP compiles on Linux
#
# Revision 1.2  2007/05/21 01:16:49  csoutheren
# Now working on Linux
#

FAX_PLUGIN_DIR=opal-3.4.1/fax
prefix=/home/robertj/opal
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
CXXFLAGS =  -Os

SONAME	= spandsp
STDCCFLAGS += -fPIC  -fPIC

SRCDIR	= .
OBJDIR	= ./obj

# CXXFLAGS += -DSPANDSP_VER3

CC		=gcc
CXX		=g++
LDSO		=-shared -Wl,-soname,$(SONAME)
PLUGINEXT	=so
STDCCFLAGS	= -fPIC
LDFLAGS		=
EXTRALIBS       = -lspandsp -ltiff

SRCS	+= spandsp_fax.cpp spandsp_util/spandsp_if.cpp

vpath	%.o $(OBJDIR)
vpath	%.cpp $(SRCDIR)
vpath	%.cpp spandsp_util

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

PLUGIN	= ./spandsp_fax_pwplugin.$(PLUGINEXT)

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

$(PLUGIN): $(OBJECTS)
	$(CC) $(LDSO) -o $@ $^ $(EXTRALIBS)

install:
	mkdir -p $(DESTDIR)$(libdir)/$(FAX_PLUGIN_DIR)
	install $(PLUGIN) $(DESTDIR)$(libdir)/$(FAX_PLUGIN_DIR)

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

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

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