mex.am 1.07 KB
Newer Older
1
2
EXEEXT = $(MEXEXT)

3
4
AM_CPPFLAGS = $(MATLAB_CPPFLAGS)
AM_CPPFLAGS += -I$(top_srcdir)/../../sources
5
6
7

DEFS += $(MATLAB_DEFS)
DEFS += -DMATLAB_MEX_FILE
8
DEFS += -DMEXEXT=\"$(MEXEXT)\"
9

10
AM_LDFLAGS = $(MATLAB_LDFLAGS)
11
12
LIBS += $(MATLAB_LIBS)

Sébastien Villemot's avatar
Sébastien Villemot committed
13
mexdir = $(libdir)/dynare/mex/matlab
Houtan Bastani's avatar
Houtan Bastani committed
14

15
all-local: $(PROGRAMS)
16
17
18
19
20
21
22
23
24
## Create symlinks in mex/matlab/, but only if the build is not
## out-of-tree (because of the Windows installer)
	if [ "$(abs_srcdir)" = "$(abs_builddir)" ]; then \
		$(MKDIR_P) $(top_srcdir)/../../matlab && \
		cd $(top_srcdir)/../../matlab && \
		for p in $(PROGRAMS); do \
			$(LN_S) -f $(abs_builddir)/$$p $$p; \
		done; \
	fi
25
26

clean-local:
27
	rm -f *.mod # Fortran modules
28
29
30
	if test -d $(top_srcdir)/../../matlab; then \
		cd $(top_srcdir)/../../matlab && rm -f $(PROGRAMS); \
	fi
31

32
# Automake provides a default rule for .f08 files, but not .F08.
33
34
%.o: %.F08
	$(AM_V_FC)$(FCCOMPILE) $(DEFS) -c -o $@ $<
35
36
37
38
39
40
41

# Rules for the Fortran 2008 interface to MEX functions
matlab_mat.mod: matlab_mex.o
matlab_mex.mod: matlab_mex.o

matlab_mex.F08: $(top_srcdir)/../../sources/matlab_mex.F08
	$(LN_S) -f $< $@