LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 01-12-2010, 03:11 AM   #1
aryan1
Member
 
Registered: Jul 2009
Posts: 50

Rep: Reputation: 16
Question GNU Make and GNU GCC DEBUG vs RELEASE compiler options


Hi All,

I have an application which has several source/header files along with their corresponding Makefiles.

I want to define two common modes for compilation of all source files contained in the project: DEBUG and RELEASE

What is the best practice to define common DEBUG and RELEASE modes with their own compiler options for all the source/header files contained in the project ?

Thanks.
 
Old 01-12-2010, 12:29 PM   #2
ForzaItalia2006
Member
 
Registered: Dec 2009
Location: Walldorf, Germany
Distribution: (X)Ubuntu, Arch, Gentoo
Posts: 205

Rep: Reputation: 67
Hey,

I don't want to say that the following solution is the ultimate common practice, but it might serve as the basis for some discussion about what is good style and what is bad style ;-)

Assuming the use of GNU make:

Code:
CFLAGS = some_options

release: build

build:
        @echo $(CFLAGS)

debug: override CFLAGS += some_debugging_opts
debug: build
Just FYI, the variable CFLAGS should be used, because this then simplifies the handling of implicit actions like for example:

main: main.o file.o


- Andi -
 
  


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
[SOLVED] need help with GNU CC (GCC) compiler smeezekitty Programming 6 09-21-2009 02:24 AM
LXer: What's new in the GNU Compiler Collection release series LXer Syndicated Linux News 0 10-31-2008 12:10 AM
Introduction to GCC - The GNU Compiler Collection jeremy Programming 2 03-28-2005 04:17 AM
where is GNU gcc compiler? karfei00 Linux - Newbie 5 06-16-2004 12:55 PM
GNU gcc 3 compiler Craneology Linux - Software 3 03-04-2003 04:35 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:11 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration