#
# Makefile for Celt Codec Plugin
#
# based on the GSM-AMR one
#

AC_PLUGIN_DIR=@AC_PLUGIN_DIR@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
target_os=@target_os@

PLUGINDIR=../..

BASENAME= celtcodec
SONAME	= $(BASENAME)

CC	 	=@CC@
CFLAGS	 	=@CFLAGS@
CXX	 	=@CXX@
LDSO	 	=@LDSO@
PLUGINEXT	=@PLUGINEXT@
STDCCFLAGS	=@STDCCFLAGS@
LDFLAGS		=@LDFLAGS@
LIBS            =

SRCS	= celtcodec.c

CFLAGS += -I../../../include
EXTRACFLAGS=-I$(PLUGINDIR)

EXTRACFLAGS += @CELT_CFLAGS@
LIBS        += @CELT_LIBS@

PLUGIN	= ./$(BASENAME)_pwplugin.$(PLUGINEXT)

%.o : %.c
	$(CC) -c $(STDCCFLAGS) $(EXTRACFLAGS) $(CFLAGS) -o $@ $<

OBJECTS	= $(patsubst %.c,%.o,$(notdir $(SRCS)))


$(PLUGIN): $(OBJECTS)

ifeq (solaris,$(findstring solaris,$(target_os)))

	$(CC) $(LDSO) $@ -o $@ $^ $(LIBS)
else	
	$(CC) $(LDSO) -o $@ $^ $(LIBS)

endif

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

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

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

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