LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   add "-g" gcc compile option to makefiles (http://www.linuxquestions.org/questions/programming-9/add-g-gcc-compile-option-to-makefiles-576138/)

powah 08-10-2007 08:45 AM

add "-g" gcc compile option to makefiles
 
HOW to add the "-g" gcc compile option to makefiles so that I choose whether to compile for debuggging or not?
e.g.
make release
make debug

However, this requires modifying all the makefiles to add the "debug" target.
Currently we build only the "release" target.
Is there a easier way (which does not requires modifying all the makefiles)?

wjevans_7d1@yahoo.co 08-11-2007 01:28 AM

Try this:
Code:

CFLAGS="-g" make release
This only works if you don't set CFLAGS within your makefiles. If you already do that, and it's always set to the same value, you can still do what you want. If, for example, you already set CFLAGS to -O3, try this:
Code:

CFLAGS="-O3 -g" make release
Hope this helps.


All times are GMT -5. The time now is 09:38 PM.