# Want to compile GENERIC w/o DEBUG symbols.



## je33 (Jun 19, 2012)

I've been building my local STABLE kernel for a long time, making localization changes to GENERIC after every csup, which has become a pain. Recently from http://forums.freebsd.org/showthread.php?t=32637 I followed the suggestion of wblock@ to build a local config that includes GENERIC. I did so and have had success with most all of the driver/options I've tried except for "makeoptions".
From `# man 5 conf` I was led to believe that declaring 
	
	



```
makeoptions     DEBUG
```
in my local config (where DEBUG has a null value) would overload the 
	
	



```
makeoptions       DEBUG=-g
```
declaration in GENERIC, but no joy. All the "makeoptions" permutations that might make sense to me (and wild guesses too), result in debug symbols being built.

My LOCAL config file:
	
	



```
# Local kernel config diffs.

include GENERIC

ident   LOCAL

makeoptions     DEBUG

nodevice        eisa
nodevice        fdc

options VESA
options SC_PIXEL_MODE
```
 What have I done wrong here?


----------



## wblock@ (Jun 19, 2012)

Untested, but I'd expect it to be

```
makeoptions DEBUG=
```

Remember that the *.symbols files will still be there in /boot/kernel from previous builds until you delete them.


----------



## je33 (Jun 19, 2012)

Wow, worked Warren! Thank you. Totally missed it. I tried:
	
	



```
makeoptions  DEBUG
```
and
	
	



```
makeoptions    DEBUG=""
```

Again, thanks for the nudge.


----------



## je33 (Jun 20, 2012)

Woah there mister, not so fast.  Turns out I snookered myself with a stale
	
	



```
#makeoptions   DEBUG=-g
```
in /usr/src/sys/amd64/conf/GENERIC. Today when making additions to my /usr/src/sys/amd64/conf/LOCAL, I took a quick look at GENERIC and noticed the error. After a fix and rebuild of the kernel, again symbols were built and installed.

Still looking for a fix, I applied some arcane logic and came up with a try of
	
	



```
nomakeoptions      DEBUG
```
for LOCAL and poof, it works. I tested it on two kernel builds/installs into an empty /boot/kernel directory.

So, now I know how to compile and install GENERIC without debug symbols. Of course this is all covered if one reads past the tantalizing suggestion (in the third example of makeoptions in config(5)) that one knows how to turn off or null a previously declared makeoptions. On down the man page nomakeoptions is clearly explained.

Mea culpa but I'm not going to lose any sleep over it, I'm old. Instead, I'm taking satisfaction that I'm still learning.


----------



## xibo (Jun 21, 2012)

*N*ot tested either, but how does writing


```
.if ${.CURDIR:M/usr/src*} || ${.CURDIR:M/usr/obj*}
  CFLAGS:=${CFLAGS:S/-g//}
.endif
```
into make.conf or src.conf sound?


----------



## je33 (Jun 21, 2012)

xibo: Thanks, looks like that should work too. But, with all respect, for now I'll stick with the mainstream solution.


----------

