LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices

Reply
 
Search this Thread
Old 08-10-2007, 08:45 AM   #1
powah
Member
 
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?
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)?
 
Old 08-11-2007, 01:28 AM   #2
wjevans_7d1@yahoo.co
Member
 
Registered: Jun 2006
Location: Mariposa
Distribution: Slackware 9.1
Posts: 938

Rep: Reputation: 30
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.
 
  


Reply


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 6 03-21-2013 10:35 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:51 PM.

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