+if ENABLE_DEBUG_MONITOR == '1'
+ # Can add MRI_UART_BAUD=115200 to next line if GDB fails to connect to MRI.
+ # Tends to happen on some Linux distros but not Windows and OS X.
+ MRI_UART = 'MRI_UART_0'
+ MRI_BREAK_ON_INIT = 1 unless defined? MRI_BREAK_ON_INIT
+else
+ MRI_UART = 'MRI_UART_0 MRI_UART_SHARE'
+ MRI_BREAK_ON_INIT = 0 unless defined? MRI_BREAK_ON_INIT
+end
+
+# Configure MRI variables based on BUILD_TYPE build type variable.
+case BUILDTYPE.downcase
+when 'release'
+ OPTIMIZATION = 2
+ MRI_ENABLE = 0
+ MRI_SEMIHOST_STDIO = 0 unless defined? MRI_SEMIHOST_STDIO
+when 'debug'
+ OPTIMIZATION = 0
+ MRI_ENABLE = 1
+ MRI_SEMIHOST_STDIO = 1 unless defined? MRI_SEMIHOST_STDIO
+when 'checked'
+ OPTIMIZATION = 2
+ MRI_ENABLE = 1
+ MRI_SEMIHOST_STDIO = 1 unless defined? MRI_SEMIHOST_STDIO
+when 'testing'
+ OPTIMIZATION = 0
+ MRI_ENABLE = 1
+ MRI_SEMIHOST_STDIO = 0 unless defined? MRI_SEMIHOST_STDIO
+end
+
+MRI_ENABLE = 1 unless defined? MRI_ENABLE # set to 0 to disable MRI
+MRI_LIB = MRI_ENABLE == 1 ? './mri/mri.ar' : ''