
libdir       = $(ARTSDIR)/lib
ARTSINCLUDE  = $(ARTSDIR)/include/arts
mcoptypedir  = $(ARTSDIR)/lib/mcop
mcopclassdir = $(mcoptypedir)/CSL


INCLUDES = -I$(top_srcdir) -I$(ARTSINCLUDE) # $(ARTS_CFLAGS)

# misc
EXTRA_HEADERS =
EXTRA_DIST    =


# libraries to build and install
if CSL_BUILD_ARTS
lib_LTLIBRARIES = libcslarts.la
endif

# libtool stuff: set version and export symbols for resolving
libcslarts_la_LDFLAGS = @STRIP_BEGIN@ \
	-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
	-release $(LT_RELEASE) \
	-export-dynamic \
	@LIBTOOL_EXPORT_OPTIONS@ \
	-module -no-undefined \
@STRIP_END@
libcslarts_la_LIBADD = -L$(ARTSDIR)/lib -lartsflow -lartsflow_idl -lmcop -ldl
libcslartsincludedir = $(ARTSDIR)/include/cslarts


# CSLARTS file setup
cslarts_headers = @STRIP_BEGIN@	\
	cslarts.idl		\
	cslarts.h		\
@STRIP_END@
cslarts_c_sources = \
	cslarts.cc		\
	adapter_impl.cc		\
	stream_impl.cc		\
	playsample_impl.cc

EXTRA_DIST += adapter_impl.h stream_impl.h playsample_impl.h

# setup CSLARTS automake variables
libcslarts_la_SOURCES     = $(cslarts_c_sources)
libcslartsinclude_HEADERS = $(cslarts_headers)

# idl generation and installation
cslarts.cc: cslarts.idl
	mcopidl -t -I$(ARTSINCLUDE) cslarts.idl
MAINTAINERCLEANFILES = cslarts.cc cslarts.h cslarts.mcoptype cslarts.mcopclass
mcoptype_DATA = cslarts.mcoptype cslarts.mcopclass
cslarts.mcoptype cslarts.mcopclass:	cslarts.cc	;
EXTRA_DIST += $(mcoptype_DATA)

# class files
mcopclass_DATA = Adapter.mcopclass

# keep static DATA
EXTRA_DIST += $(mcopclass_DATA)


# programs not to install
if CSL_BUILD_ARTS
noinst_PROGRAMS = mcopcheader cslcatcxx cslreccxx cslplaycxx
endif
mcopcheader_SOURCES = mcopcheader.cc
mcopcheader_LDADD   = -L$(libdir) -lmcop
cslplaycxx_SOURCES = cslplaycxx.cc
cslplaycxx_LDADD   = -L$(libdir) libcslarts.la -lsoundserver_idl
cslcatcxx_SOURCES = cslcatcxx.cc
cslcatcxx_LDADD   = -L$(libdir) libcslarts.la -lsoundserver_idl
cslreccxx_SOURCES = cslreccxx.cc
cslreccxx_LDADD   = -L$(libdir) libcslarts.la -lsoundserver_idl



# junk
#kdoc:
#	rm -rf doc
#	mkdir doc
#	cd doc ; kdoc ../cslarts.idl
#libcslarts.la.closure: $(OBJS)
#	echo 'main() { }' > libcslarts.la.closure.cc
#	$(LIBTOOL) g++ -o libcslarts.la.closure libcslarts.la.closure.cc $(OBJS) $(LIBS)
#	rm libcslarts.la.closure.cc
#clean:
#	rm -f *.la.closure
