# $Id: makefile.am 3785 2016-02-08 12:53:06Z bradbell $
# -----------------------------------------------------------------------------
# CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
#
# CppAD is distributed under multiple licenses. This distribution is under
# the terms of the
#                     GNU General Public License Version 3.
#
# A copy of this license is included in the COPYING file of this distribution.
# Please visit http://www.coin-or.org/CppAD/ for information on other licenses.
# -----------------------------------------------------------------------------
# automake input file
#
# CppAD puts all it's preprocessor definitions in the cppad/configure.hpp
DEFS          =
#
if CppAD_OPENMP
OPENMP_TEST = openmp_test
else
OPENMP_TEST =
endif
#
if CppAD_BTHREAD
# BTHREAD_LIB set to proper value in this case
BTHREAD_TEST = bthread_test
if CppAD_BOOST_DIR
BOOST_LIB     = -L$(BOOST_DIR)/lib
endif
else
# BTHREAD_LIB empty in this case
BTHREAD_TEST =
BOOST_LIB     =
endif
#
if CppAD_PTHREAD
PTHREAD_TEST = pthread_test
else
PTHREAD_TEST =
endif
#
check_PROGRAMS    = $(OPENMP_TEST) $(BTHREAD_TEST) $(PTHREAD_TEST)
#
if CppAD_MS_COMPILER
# AM_CXXFLAGS     = -EHsc -g $(CXX_FLAGS)
AM_CXXFLAGS       = -EHsc -DNDEBUG -O2 $(CXX_FLAGS)
else
# AM_CXXFLAGS     = -g $(CXX_FLAGS)
AM_CXXFLAGS       = -DNDEBUG -O2 $(CXX_FLAGS)
endif
#
AM_CPPFLAGS       = \
	-I. \
	-I$(top_srcdir) \
	$(BOOST_INCLUDE) \
	$(EIGEN_INCLUDE) \
	$(OPENMP_FLAGS)
#
AM_LDFLAGS        = $(OPENMP_FLAGS)
LDADD             = $(BOOST_LIB) $(BTHREAD_LIB) $(PTHREAD_LIB)
#
SHARED_SRC = \
	thread_test.cpp \
	team_thread.hpp  \
\
	multi_newton_time.cpp   multi_newton_time.hpp \
	multi_newton.cpp        multi_newton.hpp \
	multi_newton_work.cpp   multi_newton_work.hpp \
	team_example.cpp        team_example.hpp \
	harmonic_time.cpp      harmonic_time.hpp \
	harmonic.cpp           harmonic.hpp \
	harmonic_work.cpp      harmonic_work.hpp
#
bthread_test_SOURCES = \
	$(SHARED_SRC) \
	bthread/team_bthread.cpp \
	bthread/a11c_bthread.cpp  \
	bthread/simple_ad_bthread.cpp
#
openmp_test_SOURCES = \
	$(SHARED_SRC) \
	openmp/team_openmp.cpp \
	openmp/a11c_openmp.cpp  \
	openmp/simple_ad_openmp.cpp
#
pthread_test_SOURCES = \
	$(SHARED_SRC) \
	pthread/team_pthread.cpp \
	pthread/a11c_pthread.cpp  \
	pthread/simple_ad_pthread.cpp
#
dist_noinst_SCRIPTS = test.sh
#
test: check
	$(srcdir)/test.sh
