make with debug options

This is a discussion on make with debug options within the Linux Programming forums, part of the Platform Specific Boards category; Hello I'm playing with an opensource project openbsc. Now I want build the project with debug info. When I add ...

  1. #1
    Registered User
    Join Date
    Mar 2009
    Posts
    37

    make with debug options

    Hello I'm playing with an opensource project openbsc.
    Now I want build the project with debug info. When I add -g3 and O0, somehow during build (by typing "make") it overruled by -g -O2.

    So I asked a dude on IRC how to get the debug info in the executable and that guy said something with: make CFLAGS=-g3 -O0 // I don't remember exactly.
    That worked for me, I was really happy to debug properly. But now I forgot how to do it, cause I get an error from make.

    I tried:
    make CFLAGS=-g3 -O0
    make $CFLAGS=-g3 -O0
    but these result in invalid options...

    Does someone know how to do it the right way?

    Thnx...

  2. #2
    {Jaxom,Imriel,Liam}'s Dad Kennedy's Avatar
    Join Date
    Aug 2006
    Location
    Alabama
    Posts
    1,065
    I think you may need to do
    Code:
    CFLAGS=-g3 -O0 make
    as you are attempting to set the environmental variable for the make command to read.

  3. #3
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,249
    Quote it.

    Code:
    make CFLAGS='-g -O0'
    -g3 is redundant. -g is all you need.
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  4. #4
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,246
    If this project uses autoconf, you can specify the CFLAGS during the configure run.
    Code:
    ./configure CFLAGS=-'g -O0'
    bit∙hub [bit-huhb] n. A source and destination for information.

  5. #5
    Registered User
    Join Date
    Mar 2009
    Posts
    37
    Hey guys thanks!
    Code:
    make CFLAGS='-g -O0'
    worked for me.
    Bithub, I'll keep your advise in my mind.

    Thanks!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. trying to make a KenGen ( for a game tool )
    By lonewolfy in forum C# Programming
    Replies: 4
    Last Post: 03-28-2007, 08:23 AM
  2. Win32 Common Controls in C++, how do i make and use them?
    By C+noob in forum Windows Programming
    Replies: 6
    Last Post: 01-09-2006, 10:53 AM
  3. HELP!wanting to make full screen game windowed
    By rented in forum Game Programming
    Replies: 3
    Last Post: 06-11-2004, 04:19 AM
  4. make all rule
    By duffy in forum C Programming
    Replies: 9
    Last Post: 09-11-2003, 01:05 PM
  5. Question about atheists
    By gcn_zelda in forum A Brief History of Cprogramming.com
    Replies: 160
    Last Post: 08-11-2003, 11:50 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21