# WITH_DEBUG and CFLAGS sometimes are ignored



## kenorb (Nov 10, 2010)

I tried those settings in make.conf:

```
.if ${.CURDIR:M*/games/sl}
CFLAGS+=        -pg
DEBUG_FLAGS+=   -pg
WITH_DEBUG=     YES
.endif
```

And later even basic settings:

```
WITH_DEBUG=     YES
DEBUG_FLAGS+=   -pg
CFLAGS+=        -pg
CXXFLAGS+=        -pg
```

Test commands:

```
> sudo portupgrade -f sl
> gprof `which sl`
gprof: /usr/local/bin/sl.gmon: No such file or directory
```

Test 2:

```
> gdb sl
(gdb) break 1
No symbol table is loaded.  Use the "file" command.
```
Tried manually to make in work directory, and flags are not passed in.

Tested with /usr/ports/lang/php52, it does work;/

What I'm doing wrong?


----------



## luna (Nov 11, 2010)

.gmon file is generated only after you run the app.
	
	



```
$ cd games/sl
$ make DEBUG_FLAGS='-pg -static'
$ cd $(make -V WRKSRC)
$ ./sl
$ [url=http://pastebin.com/fw6P0yyY]gprof sl sl.gmon[/url]
```
-static is required because you need to link against profiled libc, ncurses, i.e. /usr/lib/libc_p.a, /usr/lib/libncurses_p.a.


----------



## kenorb (Nov 11, 2010)

Yes, it does work, I mess up something, sorry.
Thanks.


----------

