CXX_STD = CXX11
#PKG_CFLAGS = -fno-common
PKG_CPPFLAGS = -I../inst/include -DNO_FPRINTF_OUTPUT

PKG_LIBS = -L../inst -lsundials $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)

$(SHLIB): ../inst/libsundials.a

# find lib -type f -name '*'.c | tr $'\n' ' '
sunsrc = lib/cvodes/cvodea.c lib/cvodes/cvodes_spils.c lib/cvodes/cvodes_io.c lib/cvodes/cvodea_io.c lib/cvodes/cvodes_nls_sim.c lib/cvodes/cvodes.c lib/cvodes/cvodes_direct.c lib/cvodes/cvodes_nls_stg.c lib/cvodes/cvodes_nls_stg1.c lib/cvodes/cvodes_diag.c lib/cvodes/cvodes_ls.c lib/cvodes/cvodes_nls.c lib/nvector/serial/nvector_serial.c lib/nvector/serial/fnvector_serial.c lib/sunnonlinsol/newton/fsunnonlinsol_newton.c lib/sunnonlinsol/newton/sunnonlinsol_newton.c lib/sunlinsol/dense/sunlinsol_dense.c lib/sunlinsol/dense/fsunlinsol_dense.c lib/sundials/sundials_nonlinearsolver.c lib/sundials/sundials_matrix.c lib/sundials/sundials_nvector_senswrapper.c lib/sundials/sundials_direct.c lib/sundials/sundials_dense.c lib/sundials/sundials_nvector.c lib/sundials/sundials_band.c lib/sundials/sundials_math.c lib/sundials/sundials_version.c lib/sundials/sundials_linearsolver.c lib/sundials/sundials_iterative.c lib/sunmatrix/dense/fsunmatrix_dense.c lib/sunmatrix/dense/sunmatrix_dense.c lib/sunmatrix/band/fsunmatrix_band.c lib/sunmatrix/band/sunmatrix_band.c lib/sunmatrix/sparse/fsunmatrix_sparse.c lib/sunmatrix/sparse/sunmatrix_sparse.c
sunobj = $(sunsrc:.c=.o)
../inst/libsundials.a: $(sunobj)
	$(AR) -crvs ../inst/libsundials.a $(sunobj)
	$(RANLIB) $@

#MYCXXFLAGS=-O0 -g
#%.o: %.cpp
#	$(CXX) $(ALL_CPPFLAGS) $(ALL_CXXFLAGS) $(MYCXXFLAGS) -c $< -o $@
