Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => Topic started by: nfm on July 11, 2011, 04:36:35 pm

Title: Custom Makefile + Global Variable = FAIL
Post by: nfm on July 11, 2011, 04:36:35 pm
Hey everybody,

I have a problem with the debugger in codeblocks, I'm using latest svn snapshot and I'm on Windows / MinGW. I'm using a custom Makefile with custom CFLAGS. I want codeblocks to run my Makefile this way:
$ DEBUG=1 make -f Makefile

But I can't get the codeblocks to set a variable "DEBUG" to a "1" in any way, why is it so hard? So codeblocks does not respect my DEBUG flag therefore it compiles without -g which makes debugger not work at all. So I compile by hand from minsys shell. Everything goes well, but then when debugging with codeblocks, how can I view the contents of variables? Do I really have to type "$(varname)" in the memory window all time, why is it so hard and tedious, is there any way to double click? There just should be a separate window for showing stuff like that.

Thanks.



[attachment deleted by admin]
Title: Re: Custom Makefile + Global Variable = FAIL
Post by: ouch on July 11, 2011, 08:31:52 pm
Shouldn't the debug flag be set after calling make and not before?

also you can set a watch to view variable contents. (right click on the variable and select watch)
Title: Re: Custom Makefile + Global Variable = FAIL
Post by: nfm on July 11, 2011, 10:39:55 pm
DEBUG=1 should be set before make executes Makefile, so it sets debugging flags before compiling, take a look at the screenshot, or better:
Code
DBGFLAGS = -g -O0
ifdef DEBUG
    CFLAGS = $(DBGFLAGS) -Wall -std=c99
else
    CFLAGS = -Wall -std=c99 -O2 -march=native -mtune=native
endif

My point is that either setting up environment/global/temporary variables is broken in codeblocks or it is very hard to do.
Title: Re: Custom Makefile + Global Variable = FAIL
Post by: Jenna on July 11, 2011, 11:03:22 pm
I just tested it here on linux with a wxWidgets sample makefile, and no matter whether I set it before or after the make-command it works as expected.

But as I see, you have a "real" Debug-target in your makefile, why do you not set the flags here ?