Help answer threads with 0 replies.
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 01-12-2010, 04:11 AM   #1
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 ?

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

Rep: Reputation: 67

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:

CFLAGS = some_options

release: 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 -


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 03:24 AM
LXer: What's new in the GNU Compiler Collection release series LXer Syndicated Linux News 0 10-31-2008 01:10 AM
Introduction to GCC - The GNU Compiler Collection jeremy Programming 2 03-28-2005 05:17 AM
where is GNU gcc compiler? karfei00 Linux - Newbie 5 06-16-2004 01:55 PM
GNU gcc 3 compiler Craneology Linux - Software 3 03-04-2003 05:35 AM > Forums > Non-*NIX Forums > Programming

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

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