mex_PROGRAMS = ms_sbvar_create_init_file ms_sbvar_command_line

DWSWITCHDIR = $(top_srcdir)/../../../contrib/ms-sbvar/switch_dw
DWUTILITIESDIR = $(top_srcdir)/../../../contrib/ms-sbvar/utilities_dw

DYNMEXSRCDIR = $(top_srcdir)/../../sources
MSMEXSRCDIR = $(DYNMEXSRCDIR)/ms-sbvar

AM_CPPFLAGS += $(GSL_CPPFLAGS) -DSTRUCTURED_COLUMN_MAJOR -I$(MSMEXSRCDIR) -I$(DWUTILITIESDIR)/include -I$(DWSWITCHDIR)/switching -I$(DWSWITCHDIR)/state_space -I$(DWSWITCHDIR)/state_space/sbvar

LIBS += $(GSL_LIBS)
AM_LDFLAGS += $(GSL_LDFLAGS)

DWUTILS = \
	dw_array.c \
	dw_matrix_array.c \
	dw_ascii.c \
	dw_parse_cmd.c \
	dw_elliptical.c \
	dw_error.c \
	dw_histogram.c \
	dw_math.c \
	dw_matrix.c \
	bmatrix.c \
	dw_matrix_sort.c \
	dw_rand_gsl.c \
	dw_matrix_rand.c

MSMEXSRC = \
	mex_top_level.cc \
	modify_for_mex.cc

nodist_ms_sbvar_create_init_file_SOURCES = \
	dw_switch.c \
	dw_switchio.c \
	dw_dirichlet_restrictions.c \
	dw_metropolis_theta.c \
	create_init_file.c \
	VARbase.c \
	VARio.c \
	VARio_matlab.c \
	$(DWUTILS) \
	$(MSMEXSRC)

nodist_ms_sbvar_command_line_SOURCES = \
	dw_switch.c \
	dw_switchio.c \
	dw_dirichlet_restrictions.c \
	dw_metropolis_theta.c \
	dw_switch_opt.c \
	dw_mdd_switch.c \
	VARbase.c \
	VARio.c \
	dw_sbvar_command_line.c \
	sbvar_estimate.c \
	sbvar_simulate.c \
	sbvar_probabilities.c \
	sbvar_mdd.c \
	sbvar_forecast.c \
	sbvar_variance_decomposition.c \
	sbvar_impulse_responses.c \
	dw_csminwel.c \
	$(DWUTILS) \
	$(MSMEXSRC)

BUILT_SOURCES = $(nodist_ms_sbvar_create_init_file_SOURCES) $(nodist_ms_sbvar_command_line_SOURCES)
CLEANFILES = $(nodist_ms_sbvar_create_init_file_SOURCES) $(nodist_ms_sbvar_command_line_SOURCES)

dw_array.c dw_matrix_array.c: %.c: $(DWUTILITIESDIR)/arrays/%.c
	$(LN_S) -f $< $@
dw_ascii.c dw_parse_cmd.c: %.c: $(DWUTILITIESDIR)/ascii/%.c
	$(LN_S) -f $< $@
dw_elliptical.c: %.c: $(DWUTILITIESDIR)/elliptical/%.c
	$(LN_S) -f $< $@
dw_error.c: %.c: $(DWUTILITIESDIR)/error/%.c
	$(LN_S) -f $< $@
dw_histogram.c: %.c: $(DWUTILITIESDIR)/histogram/%.c
	$(LN_S) -f $< $@
dw_math.c: %.c: $(DWUTILITIESDIR)/math/%.c
	$(LN_S) -f $< $@
dw_matrix.c bmatrix.c: %.c: $(DWUTILITIESDIR)/matrix/%.c
	$(LN_S) -f $< $@
dw_matrix_sort.c: %.c: $(DWUTILITIESDIR)/sort/%.c
	$(LN_S) -f $< $@
dw_rand_gsl.c dw_matrix_rand.c: %.c: $(DWUTILITIESDIR)/stat/%.c
	$(LN_S) -f $< $@
$(MSMEXSRC): %.cc: $(MSMEXSRCDIR)/%.cc
	$(LN_S) -f $< $@
dw_switch.c dw_switchio.c dw_dirichlet_restrictions.c dw_metropolis_theta.c dw_switch_opt.c dw_mdd_switch.c: %.c: $(DWSWITCHDIR)/switching/%.c
	$(LN_S) -f $< $@
create_init_file.c VARbase.c VARio.c VARio_matlab.c dw_sbvar_command_line.c sbvar_estimate.c sbvar_simulate.c sbvar_probabilities.c sbvar_mdd.c sbvar_forecast.c sbvar_variance_decomposition.c sbvar_impulse_responses.c dw_csminwel.c: %.c: $(DWSWITCHDIR)/state_space/sbvar/%.c
	$(LN_S) -f $< $@
