.PHONY: static

PKG_CPPFLAGS=-DNO_FPRINTF_OUTPUT -I"../inst/include" -include stan_sundials_printf_override.hpp

#SUNDIALS_CVODES = cvodes/cvodes_spils.c cvodes/cvodes_io.c cvodes/cvodes_bbdpre.c cvodes/cvodes_nls_stg1.c cvodes/fmod/fcvodes_mod.c cvodes/cvodes.c cvodes/cvodes_nls_sim.c cvodes/cvodes_diag.c cvodes/cvodes_ls.c cvodes/cvodes_direct.c cvodes/cvodes_nls.c cvodes/cvodes_nls_stg.c cvodes/cvodea.c cvodes/cvodea_io.c cvodes/cvodes_bandpre.c sundials/sundials_matrix.c sundials/sundials_band.c sundials/sundials_math.c sundials/fmod/fsundials_futils_mod.c sundials/fmod/fsundials_nonlinearsolver_mod.c sundials/fmod/fsundials_types_mod.c sundials/fmod/fsundials_nvector_mod.c sundials/fmod/fsundials_matrix_mod.c sundials/fmod/fsundials_linearsolver_mod.c sundials/sundials_linearsolver.c sundials/sundials_nvector.c sundials/sundials_direct.c sundials/sundials_dense.c sundials/sundials_futils.c sundials/sundials_version.c sundials/sundials_iterative.c sundials/sundials_nvector_senswrapper.c sundials/sundials_nonlinearsolver.c sunmatrix/band/sunmatrix_band.c sunmatrix/dense/sunmatrix_dense.c sunlinsol/band/sunlinsol_band.c sunlinsol/dense/sunlinsol_dense.c sunnonlinsol/newton/sunnonlinsol_newton.c sunnonlinsol/fixedpoint/sunnonlinsol_fixedpoint.c
SUNDIALS_CVODES = cvodes/cvodes_spils.c cvodes/cvodes_io.c cvodes/cvodes_bbdpre.c cvodes/cvodes_nls_stg1.c cvodes/cvodes.c cvodes/cvodes_nls_sim.c cvodes/cvodes_diag.c cvodes/cvodes_ls.c cvodes/cvodes_direct.c cvodes/cvodes_nls.c cvodes/cvodes_nls_stg.c cvodes/cvodea.c cvodes/cvodea_io.c cvodes/cvodes_bandpre.c sundials/sundials_matrix.c sundials/sundials_band.c sundials/sundials_math.c sundials/sundials_linearsolver.c sundials/sundials_nvector.c sundials/sundials_direct.c sundials/sundials_dense.c sundials/sundials_version.c sundials/sundials_iterative.c sundials/sundials_nvector_senswrapper.c sundials/sundials_nonlinearsolver.c sunmatrix/band/sunmatrix_band.c sunmatrix/dense/sunmatrix_dense.c sunlinsol/band/sunlinsol_band.c sunlinsol/dense/sunlinsol_dense.c sunnonlinsol/newton/sunnonlinsol_newton.c sunnonlinsol/fixedpoint/sunnonlinsol_fixedpoint.c
#SUNDIALS_IDAS = idas/idas_io.c idas/idas_nls_sim.c idas/fmod/fidas_mod.c idas/idas_ls.c idas/idas_ic.c idas/idaa_io.c idas/idas_direct.c idas/idas_spils.c idas/idas_nls_stg.c idas/idas.c idas/idas_bbdpre.c idas/idas_nls.c idas/idaa.c
SUNDIALS_IDAS = idas/idas_io.c idas/idas_nls_sim.c idas/idas_ls.c idas/idas_ic.c idas/idaa_io.c idas/idas_direct.c idas/idas_spils.c idas/idas_nls_stg.c idas/idas.c idas/idas_bbdpre.c idas/idas_nls.c idas/idaa.c
#SUNDIALS_KINSOL = kinsol/kinsol.c kinsol/kinsol_io.c kinsol/kinsol_bbdpre.c kinsol/kinsol_spils.c kinsol/kinsol_ls.c kinsol/kinsol_direct.c 
SUNDIALS_KINSOL =
SUNDIALS_NVECSERIAL = nvector/serial/nvector_serial.c
SOURCES = $(SUNDIALS_CVODES) $(SUNDIALS_IDAS) $(SUNDIALS_KINSOL) $(SUNDIALS_NVECSERIAL)
OBJECTS = $(SOURCES:.c=.o)

static: $(OBJECTS)
	@mkdir -p ../lib
	$(AR) -rs ../lib/libStanHeaders.a $(OBJECTS)
				
clean:
	rm -rf ../lib
	rm $(OBJECTS)

