Index: mttroot/mtt/bin/mtt ================================================================== --- mttroot/mtt/bin/mtt +++ mttroot/mtt/bin/mtt @@ -15,10 +15,14 @@ ############################################################### ## Version control history ############################################################### ## $Header$ ## $Log$ +## Revision 1.335 2002/05/01 17:30:55 geraint +## Improved pre-processor directives to better accommodate future alternatives (matlab) +## if necessary. +## ## Revision 1.334 2002/05/01 14:10:22 gawthrop ## Added -dr foo (reads from dir foo) option ## ## Revision 1.333 2002/04/28 18:41:26 geraint ## Fixed [ 549658 ] awk should be gawk. @@ -1583,10 +1587,13 @@ rm -f mtt_error.txt mtt_info.txt *_ode2odes.out rm -f *_*_write.r *_simpar.m *_simpar.p rm -f *_cseo.oct *_input.oct *_simpar.oct *_smxax.oct rm -f *_csex.oct *_numpar.oct *_smxa.oct *_state.oct rm -f *_ode.oct *_odeo.oct + rm -f *_cseo.mexglx *_input.mexglx *_simpar.mexglx *_smxax.mexglx + rm -f *_csex.mexglx *_numpar.mexglx *_smxa.mexglx *_state.mexglx + rm -f *_ode.mexglx *_odeo.mexglx rm -f *_cseo.cc *_input.cc *_simpar.cc *_smxax.cc rm -f *_csex.cc *_numpar.cc *_smxa.cc *_state.cc rm -f *_ode.cc *_odeo.cc rm -f *_logic.m *_logic.cc *_logic.oct rm -f *_state.m *_state.cc *_state.oct @@ -1620,10 +1627,13 @@ rm -f mtt_error.txt mtt_info.txt $1_ode2odes.out rm -f $1_*_write.r $1_simpar.m $1_simpar.p rm -f $1_cseo.oct $1_input.oct $1_simpar.oct $1_smxax.oct rm -f $1_csex.oct $1_numpar.oct $1_smxa.oct $1_state.oct rm -f $1_ode.oct $1_odeo.oct + rm -f $1_cseo.mexglx $1_input.mexglx $1_simpar.mexglx $1_smxax.mexglx + rm -f $1_csex.mexglx $1_numpar.mexglx $1_smxa.mexglx $1_state.mexglx + rm -f $1_ode.mexglx $1_odeo.mexglx rm -f $1_cseo.cc $1_input.cc $1_simpar.cc $1_smxax.cc rm -f $1_csex.cc $1_numpar.cc $1_smxa.cc $1_state.cc rm -f $1_ode.cc $1_odeo.cc rm -f $1_logic.m $1_logic.cc $1_logic.oct rm -f $1_state.m $1_state.cc $1_state.oct @@ -2097,10 +2107,17 @@ .PRECIOUS: mtt_%.oct mtt_%.oct: mtt_%.cc echo Compiling \$< ${MKOCTFILE} -DCODEGENTARGET=OCTAVEDLD $define_octave_dev \$< +## .mex files +$1_%.mexglx: $1_%.cc $1_def.h $1_sympar.h $1_cr.h + echo Creating $1_\$*.mexglx + ${MTT_CXX} -shared -o $1_\$*.mexglx $1_\$*.cc \ + ${MTT_MATLAB_FLAGS} -DCODEGENTARGET=MATLABMEX \ + ${MTT_CXXINCS} ${MTT_CXXLIBS} ${MTT_CXXFLAGS} ${MTT_LIB}/cc/mtt_kpathsea.cc + ## .cc files .PRECIOUS: %.cc # Don't let mtt delete them $1_%.cc: $1_%.m mtt_m2cc.sh $1 \$* cat Index: mttroot/mtt/bin/mttrc ================================================================== --- mttroot/mtt/bin/mttrc +++ mttroot/mtt/bin/mttrc @@ -13,10 +13,14 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.31 2002/05/02 20:12:45 geraint +## Added -Wl,--rpath to MTT_CXXLIBS. Sets the runtime linker path so that the +## sys-admin does not have to ldconfig the octave directory for -cc to work. +## ## Revision 1.30 2002/05/02 11:10:11 geraint ## s/loctave/loctinterp/ ## ## Revision 1.29 2002/05/02 11:03:46 geraint ## Reinstated -liboctinterp and -lncurses; needed by xleftdiv. @@ -218,13 +222,22 @@ DEBUG="-g" OPTIM="-O3" FLAGS="-fno-rtti -fno-exceptions -fno-implicit-templates" + # matlab flags + + MATLAB_ARCH="glnx86" + MATLAB_ROOT="/usr/local/matlab6p1" + MATLAB_FLAGS="-shared -fPIC -ansi -D_GNU_SOURCE -pthread" + MATLAB_INCS="-I${MATLAB_ROOT}/extern/include" + MATLAB_LIBS="-Wl,--rpath-link,${MATLAB_ROOT}/extern/lib/${MATLAB_ARCH},--rpath-link,${MATLAB_ROOT}/bin/${MATLAB_ARCH} -L${MATLAB_ROOT}/bin/${MATLAB_ARCH} -lmx -lmex -lm" + # exported variables export MTT_CXX="g++" export MTT_CXXFLAGS="${DEBUG} ${OPTIM} ${FLAGS}" export MTT_CXXLIBS="${LOCTAVE} ${LSYSTEM}" export MTT_CXXINCS="-I. ${IOCTAVE}" export MTT_LDFLAGS=" " + export MTT_MATLAB_FLAGS="${MATLAB_FLAGS} ${MATLAB_INCS} ${MATLAB_LIBS}" fi Index: mttroot/mtt/bin/trans/mtt_header ================================================================== --- mttroot/mtt/bin/trans/mtt_header +++ mttroot/mtt/bin/trans/mtt_header @@ -10,10 +10,14 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.46 2002/05/07 13:48:43 geraint +## Improved clarity of code generated for -cc and -oct (except ode2odes). +## Octave DEFUN_DLDs now call (rather than replace) their .cc equivalents. +## ## Revision 1.45 2002/05/02 09:30:22 gawthrop ## _ssim.m now returns t as 4th arg ## ## Revision 1.44 2002/05/01 17:30:56 geraint ## Improved pre-processor directives to better accommodate future alternatives (matlab) @@ -818,10 +822,40 @@ printf " ${arg_type}\t${w}\t= args(${j}).%s ();\n" ${vector_value} ;; esac done } + +map_mex_inputs () +{ + s=${1:-""} # comma separated input list + if [ -z ${s:-""} ];then return; fi + c=`get_field ${s} 0` # count of inputs + i=0 + cat <"} args=${2:-""} @@ -838,13 +872,94 @@ retval (0) = ${func} (${args}); return (retval); } #endif // (CODEGENTARGET == OCTAVEDLD) + +EOF +} + +write_mex () +{ + func=${1:-""} + args=${2:-""} + cat <