News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

Custom Makefile + Global Variable = FAIL

Started by nfm, July 11, 2011, 04:36:35 PM

Previous topic - Next topic

nfm

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]

ouch

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)

nfm

DEBUG=1 should be set before make executes Makefile, so it sets debugging flags before compiling, take a look at the screenshot, or better:
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.

Jenna

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 ?