DOCGroup/MPC

Turn off GNU compiler optimizations?

Closed this issue · 2 comments

Hello,
Is there a way to turn off GNU compiler optimizations from the .mpc file?
My workaround for this is to remove the -O flags from the GENFLAGS macros in every Makefile but that is quite cumbersome.

Thank you for the assistance.

I assume you are using the 'make' project type. If you add the following to your command line, it should cause GENFLAGS to be empty:

-value_template optimize=

Thank you @ocielliottc that worked well.
For anyone that sees this in the future, below is an example .mpc and .mwc file to make this work.

Sample.mpc

project (Sample) {
  exename = Sample
  install = .

  // GNUmake specific flag to enable c++11
  specific(make) {
    compile_flags += -std=c++11
  }

  Source_Files {
    main.cpp
  }
}

Sample.mwc

workspace (Sample) {
  //Turn off compiler optimizations
  cmdline += -value_template optimize=
  Sample.mpc
}

Run MPC
$MPC_ROOT/mwc.pl -type make Sample.mwc