

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


# libraries to build and install
lib_LTLIBRARIES = libcsl.la

# libtool stuff: set version and export symbols for resolving
libcsl_la_LDFLAGS = @STRIP_BEGIN@ \
	-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
	-release $(LT_RELEASE) \
	-export-dynamic \
	@LIBTOOL_EXPORT_OPTIONS@ \
@STRIP_END@
libcslincludedir = $(includedir)/csl
libcsl_la_LIBADD = # -lm


# CSL file setup
csl_public_headers = @STRIP_BEGIN@	\
	csl.h			\
	csldefs.h		\
	cslmain.h		\
	cslpcm.h		\
	cslsample.h		\
	cslutils.h		\
	cslconfig.h		\
@STRIP_END@
csl_private_headers = @STRIP_BEGIN@	\
	artsbinbuffer.h		\
	artscsladapter.h	\
	artsdriver.h		\
	artsmcopdispatcher.h	\
	artsmcopglobalcomm.h	\
	artsmcopmarshal.h	\
	artsmcopmethods.h	\
	artsmd5.h		\
	artssocket.h		\
	artssoundserver.h	\
	cslprivate.h		\
@STRIP_END@
csl_c_sources = \
	artsbinbuffer.c		\
	artscsladapter.c	\
	artsdriver.c		\
	artsmcopdispatcher.c	\
	artsmcopglobalcomm.c	\
	artsmcopmarshal.c	\
	artssoundserver.c	\
	artsmd5.c		\
	artssocket.c		\
	cslmain.c		\
	cslpcm.c		\
	cslsample.c		\
	cslutils.c		\
	ossdriver.c

CLEANFILES = xgen-cch
$(libcsl_la_OBJECTS): cslconfig.h
cslconfig.h: $(top_builddir)/config.status # Makefile
	cd . \
	&& echo "/* Generated data from $< (by make $@) */" > xgen-cch \
	&& echo >> xgen-cch \
	&& echo "#ifndef __CSL_CONFIG_H__" >> xgen-cch \
	&& echo "#define __CSL_CONFIG_H__" >> xgen-cch \
	&& echo >> xgen-cch \
	&& echo "#define CSL_BIG_ENDIAN   	(4321)" >> xgen-cch \
	&& echo "#define CSL_LITTLE_ENDIAN	(1234)" >> xgen-cch \
	&& echo "#define CSL_BYTE_ORDER   	(@CSL_BYTE_ORDER@)" >> xgen-cch \
	&& echo >> xgen-cch \
	&& echo "#endif /* __CSL_CONFIG_H__ */" >> xgen-cch \
	&& echo >> xgen-cch \
	&& echo "/* Generated data ends here */" >> xgen-cch \
	&& (cp xgen-cch $@) \
	&& rm -f xgen-cch
#	&& (cmp -s xgen-cch $@ || cp xgen-cch $@) 

# setup CSL automake variables
libcsl_la_SOURCES     = $(csl_c_sources)
libcslinclude_HEADERS = $(csl_public_headers)
EXTRA_DIST            = $(csl_private_headers)

# programs
progsLDADD     = libcsl.la

# programs to install
bin_PROGRAMS = cslcat cslplay cslrec

cslplay_SOURCES = cslplay.c
cslplay_LDADD   = $(progsLDADD)

cslcat_SOURCES = cslcat.c
cslcat_LDADD   = $(progsLDADD)

cslrec_SOURCES = cslrec.c
cslrec_LDADD   = $(progsLDADD)

# programs not to install
noinst_PROGRAMS = # testcsl
# testcsl_SOURCES = testcsl.c
# testcsl_LDADD   = $(progs_LDADD)


MCOPMETHOD_RULE = \
  ../adapter/mcopcheader -p CSL \
  -i Arts::GlobalComm Arts::SoundServerV2 \
     CSL::Adapter Arts::StereoVolumeControl

# custom build rulez
.PHONY: build-methods
build-methods:
	cd $(srcdir) \
	&& echo "/* Generated data (by make $@) */" >artsmcopmethods.h \
	&& echo >>artsmcopmethods.h \
	&& $(MCOPMETHOD_RULE) >>artsmcopmethods.h

# misc
EXTRA_HEADERS =
EXTRA_DIST    +=
