# $Id: makefile.am 3768 2015-12-28 18:58:35Z 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_ADOLC
ADOLC_SRC_FILES    =  mul_level_adolc.cpp mul_level_adolc_ode.cpp
ADOLC_EXTRA_FILES  =
ADOLC_LIB          = -ladolc -lColPack -L$(ADOLC_DIR)/lib -L$(ADOLC_DIR)/lib64
ADOLC_FLAGS        = -DCPPAD_ADOLC_EXAMPLES -I$(ADOLC_DIR)/include
else
ADOLC_EXTRA_FILES =  mul_level_adolc.cpp mul_level_adolc_ode.cpp
ADOLC_SRC_FILES   =
ADOLC_LIB         =
ADOLC_FLAGS       =
endif
# -------------------------------------------------------------------------
if CppAD_HAVE_AR
if CppAD_EIGEN_DIR
# make a special library so can have it's own compile flags (see configure.ac)
EIGEN_EXTRA_FILES   =
noinst_LIBRARIES    = libeigen.a
libeigen_a_SOURCES  =  eigen_det.cpp eigen_array.cpp
EIGEN_LIB           = -L. -leigen
EIGEN_FLAGS         = -DCPPAD_EIGEN_EXAMPLES
libeigen_a_CXXFLAGS = \
	-g $(CXX_FLAGS_EIGEN) \
	-DCPPAD_EIGEN_EXAMPLES \
	-I$(EIGEN_DIR)/include
else
EIGEN_EXTRA_FILES   = eigen_det.cpp eigen_array.cpp
EIGEN_LIB           =
EIGEN_FLAGS         =
endif
else
EIGEN_EXTRA_FILES   = eigen_det.cpp eigen_array.cpp
EIGEN_LIB           =
EIGEN_FLAGS         =
endif
# -------------------------------------------------------------------------
# auto-tools does not support use of colpack
EXTRA_DIST        =  \
	test_one.sh.in \
	colpack_hes.cpp \
	colpack_jac.cpp \
	$(ADOLC_EXTRA_FILES) \
	$(EIGEN_EXTRA_FILES)
#
check_PROGRAMS    = example
#
if CppAD_MS_COMPILER
AM_CXXFLAGS       = -EHsc -g $(ADOLC_FLAGS) $(EIGEN_FLAGS) $(CXX_FLAGS)
else
AM_CXXFLAGS       = -g $(ADOLC_FLAGS) $(EIGEN_FLAGS) $(CXX_FLAGS)
endif
#
AM_CPPFLAGS       = \
	-I. \
	-I$(top_srcdir) \
	$(BOOST_INCLUDE) \
	$(EIGEN_INCLUDE) \
	$(ADOLC_FLAGS) \
	$(EIGEN_FLAGS)
#
LDADD        =  $(ADOLC_LIB)  $(BTHREAD_LIB) $(EIGEN_LIB) $(PTHREAD_LIB)
#
example_SOURCES   = \
	$(ADOLC_SRC_FILES) \
	\
	example.cpp \
	abort_recording.cpp \
	abs.cpp \
	acos.cpp \
	acosh.cpp \
	add.cpp \
	add_eq.cpp \
	ad_assign.cpp \
	ad_ctor.cpp \
	ad_fun.cpp \
	ad_in_c.cpp \
	ad_input.cpp \
	ad_output.cpp \
	asin.cpp \
	asinh.cpp \
	atan.cpp \
	atanh.cpp \
	atan2.cpp \
	azmul.cpp \
	base_alloc.hpp \
	base_require.cpp \
	bender_quad.cpp \
	bool_fun.cpp \
	bool_sparsity.cpp \
	capacity_order.cpp \
	change_param.cpp \
	check_for_nan.cpp \
	check_numeric_type.cpp \
	check_simple_vector.cpp \
	compare.cpp \
	compare_change.cpp \
	complex_poly.cpp \
	cond_exp.cpp \
	conj_grad.cpp \
	cos.cpp \
	cosh.cpp \
	cppad_vector.cpp \
	dependency.cpp \
	div.cpp \
	div_eq.cpp \
	equal_op_seq.cpp \
	erf.cpp \
	error_handler.cpp \
	exp.cpp \
	expm1.cpp \
	for_one.cpp \
	for_two.cpp \
	forward.cpp \
	forward_dir.cpp \
	forward_order.cpp \
	for_sparse_jac.cpp \
	fun_assign.cpp \
	fun_check.cpp \
	hes_lagrangian.cpp \
	hes_lu_det.cpp \
	hes_minor_det.cpp \
	hessian.cpp \
	hes_times_dir.cpp \
	independent.cpp \
	index_sort.cpp \
	integer.cpp \
	interface2c.cpp\
	interp_onetape.cpp\
	interp_retape.cpp\
	jac_lu_det.cpp \
	jac_minor_det.cpp \
	jacobian.cpp \
	num_limits.cpp \
	log.cpp \
	log1p.cpp \
	log10.cpp \
	lu_factor.cpp \
	lu_invert.cpp \
	lu_ratio.cpp \
	lu_solve.cpp \
	lu_vec_ad.cpp \
	lu_vec_ad.hpp \
	lu_vec_ad_ok.cpp \
	mul.cpp \
	mul_eq.cpp \
	mul_level.cpp \
	mul_level_ode.cpp \
	nan.cpp \
	near_equal.cpp \
	near_equal_ext.cpp \
	number_skip.cpp \
	numeric_type.cpp \
	ode_err_control.cpp \
	ode_err_maxabs.cpp \
	ode_gear.cpp \
	ode_gear_control.cpp\
	ode_stiff.cpp \
	ode_taylor.cpp \
	opt_val_hes.cpp \
	optimize.cpp \
	par_var.cpp \
	poly.cpp \
	pow.cpp \
	pow_int.cpp \
	print_for.cpp \
	reverse_any.cpp \
	reverse_one.cpp \
	reverse_three.cpp \
	reverse_two.cpp \
	rev_one.cpp \
	rev_sparse_hes.cpp \
	rev_sparse_jac.cpp \
	rev_two.cpp \
	romberg_mul.cpp \
	romberg_one.cpp \
	rosen_34.cpp \
	runge45_1.cpp \
	runge45_2.cpp \
	seq_property.cpp \
	simple_vector.cpp \
	sign.cpp \
	sin.cpp \
	sinh.cpp \
	sparse_hessian.cpp \
	sparse_jacobian.cpp \
	sparse_sub_hes.cpp \
	sparsity_sub.cpp \
	sqrt.cpp \
	stack_machine.cpp \
	sub.cpp \
	sub_eq.cpp \
	sub_sparse_hes.cpp \
	tan.cpp \
	tanh.cpp \
	tape_index.cpp \
	thread_alloc.cpp \
	to_string.cpp \
	unary_minus.cpp \
	unary_plus.cpp \
	value.cpp \
	var2par.cpp \
	vec_ad.cpp  \
	vector_bool.cpp

test: check
	./example
