Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 08-10-2007, 08:45 AM   #1
Registered: Mar 2005
Distribution: FC, Gentoo
Posts: 276

Rep: Reputation: 30
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?
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)?
Old 08-11-2007, 01:28 AM   #2
Registered: Jun 2006
Location: Mariposa
Distribution: Slackware 9.1
Posts: 938

Rep: Reputation: 30
Try this:
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:
CFLAGS="-O3 -g" make release
Hope this helps.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
bash script: using "select" to show multi-word options? (like "option 1"/"o zidane_tribal Programming 7 12-19-2015 01:03 AM
Is it possible to add a "DESTDIR" variable in makefiles that don't have it ? nasty_daemon Programming 2 11-25-2005 01:24 PM
anging "Protocol" option to "IMPS/2" in XF86Config-4 causes problems zstingx Linux - General 2 10-27-2003 09:47 AM
GCC option "-fshared-data" doesn't work jph Programming 0 08-05-2003 05:39 AM
GCC option "-fshared-data" doesn't work jph Linux - General 0 08-05-2003 02:49 AM

All times are GMT -5. The time now is 08:06 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration