
SUBDIRS = copulas distributions integrals interpolations \
          matrixutilities ode optimization randomnumbers solvers1d \
          statistics

AM_CPPFLAGS = -I${top_builddir} -I${top_srcdir}

this_includedir=${includedir}/${subdir}
this_include_HEADERS = \
	abcdmathfunction.hpp \
	all.hpp \
	array.hpp \
	autocovariance.hpp \
	bernsteinpolynomial.hpp \
	beta.hpp \
	bspline.hpp \
	comparison.hpp \
	errorfunction.hpp \
	expm1.hpp \
	factorial.hpp \
	fastfouriertransform.hpp \
	functional.hpp \
	generallinearleastsquares.hpp \
	kernelfunctions.hpp \
	incompletegamma.hpp \
	interpolation.hpp \
	linearleastsquaresregression.hpp \
	matrix.hpp \
	modifiedbessel.hpp \
	pascaltriangle.hpp \
	polynomialmathfunction.hpp \
	primenumbers.hpp \
	quadratic.hpp \
	rounding.hpp \
	richardsonextrapolation.hpp \
	sampledcurve.hpp \
	solver1d.hpp \
	transformedgrid.hpp

cpp_files = \
	abcdmathfunction.cpp \
	bernsteinpolynomial.cpp \
	beta.cpp \
	bspline.cpp \
	errorfunction.cpp \
	expm1.cpp \
	factorial.cpp \
	incompletegamma.cpp \
	matrix.cpp \
	modifiedbessel.cpp \
	pascaltriangle.cpp \
	polynomialmathfunction.cpp \
	primenumbers.cpp \
	quadratic.cpp \
	richardsonextrapolation.cpp \
	rounding.cpp

if UNITY_BUILD

nodist_libMath_la_SOURCES = unity.cpp

unity.cpp: Makefile.am
	echo "/* This file is automatically generated; do not edit.     */" > $@
	echo "/* Add the files to be included into Makefile.am instead. */" >> $@
	echo >> $@
	for i in $(cpp_files); do \
		echo "#include \"${subdir}/$$i\"" >> $@; \
	done

EXTRA_DIST = $(cpp_files)

else

libMath_la_SOURCES = $(cpp_files)

endif

libMath_la_LIBADD = \
    copulas/libCopulas.la \
    distributions/libDistributions.la \
    integrals/libIntegrals.la \
    interpolations/libInterpolations.la \
    matrixutilities/libMatrixUtilities.la \
    optimization/libOptimization.la \
    randomnumbers/libRandomNumbers.la \
    statistics/libStatistics.la

noinst_LTLIBRARIES = libMath.la

all.hpp: Makefile.am
	echo "/* This file is automatically generated; do not edit.     */" > ${srcdir}/$@
	echo "/* Add the files to be included into Makefile.am instead. */" >> ${srcdir}/$@
	echo >> ${srcdir}/$@
	for i in $(filter-out all.hpp sampledcurve.hpp, $(this_include_HEADERS)); do \
		echo "#include <${subdir}/$$i>" >> ${srcdir}/$@; \
	done
	echo >> ${srcdir}/$@
	subdirs='$(SUBDIRS)'; for i in $$subdirs; do \
		echo "#include <${subdir}/$$i/all.hpp>" >> ${srcdir}/$@; \
	done

