if HAVE_MATLAB ## @MEXEXT@ exists if HAVE_MATLAB passed MEX_PROGS = interpos.@MEXEXT@ M_PROGS = interpos.m endif ## Mex is itself a build tool that will determine the compiler(flags) etc. ## It will ignore the compiler(flags) detected by autoconf. To avoid Automake ## trying to build from .f90 sources, use _SCRIPTS instead of _PROGRAMS. ## TODO: harnass mex's compiler (flags and libs) to choose custom compiler ## and blas libs from ./configure. ## If we know how to do this, we should be able to compile the mexfile by ## linking to the previously built libinterpos.so using the same compiler... if HAVE_BLAS # Use MathWorks' lapack FLIBS=-lmwlapack else # Use own functions SRCS_lap = ../f90/dpgbtrf_s.f90 endif ## Treat mex files as scripts (with built sources) ## and .m files too. mexfiles_SCRIPTS = $(MEX_PROGS) mfiles_SCRIPTS = $(M_PROGS) mexsources_DATA = interpos.f90 ## Install mex files in matlab/bin, .m files too, ## and .f90 sources to share/src/matlab. mexfilesdir = $(exec_prefix)/matlab/bin mfilesdir = $(exec_prefix)/matlab/bin mexsourcesdir = $(datadir)/src/matlab ## Generate interpos.f90 file needed for interpos.mexa64 BUILT_SOURCES = interpos.f90 interpos.f90: ( cd $(srcdir) && cat $(MODS) $(SRCS_topmatlab) $(SRCS_LIB) $(SRCS_lap) ) > $@ ## Sources borrowed from ../f90 MODS = ../f90/prec_rkind.f90 ../f90/checknanos_module.f90 ../f90/interpos_module.f90 SRCS_LIB = ../f90/cbsplgen.f90 ../f90/cbsplgenp.f90 ../f90/cbfitbnd.f90 ../f90/cbfitper.f90 \ ../f90/splipera.f90 ../f90/splibnda.f90 ../f90/intlinear.f90 ../f90/intquadratic.f90 ## Build using an implicit rule to handle this type SUFFIXES = .f90 .@MEXEXT@ .f90.@MEXEXT@: $(MEX) $(FLIBS) -v -output $@ $< if ENABLE_TESTS check_SCRIPTS = test_interpos.sh BUILT_SOURCES += test_interpos.sh endif TESTS = $(check_SCRIPTS) TEST_EXTENSIONS = .sh SH_LOG_DRIVER_FLAGS = --ignore-exit --comments SH_LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) \ $(top_srcdir)/build-aux/tap-driver.sh test_interpos_SRCS = test_interpos.m test_interpos.in test_interpos.sh: %.sh:%.in sed -e 's@__MATLAB__@$(MATLAB)@g' \ -e 's@__SED__@$(SED)@g' \ -e 's@__M_PROG__@$*@g' \ $< > $@ chmod +x $@ ## Clean up MOSTLYCLEANFILES = *.$(FC_MODEXT) $(mexfiles_SCRIPTS) $(check_SCRIPTS) $(BUILT_SOURCES) ## Sources needed in the tarball EXTRA_DIST = $(test_interpos_SRCS) $(SRCS_topmatlab) $(M_PROGS) SRCS_topmatlab = interpos_matlab_top.f90