View Single Post
  #3   (View Single Post)  
Old 27th July 2020
bashrules's Avatar
bashrules bashrules is offline
Aspiring Unix Greybeard
 
Join Date: Mar 2010
Location: Here
Posts: 80
Default

About CFLAGS, vs COPTS, CPUFLAGS, CPU_FLAGS:

My original /etc/mk.conf file from many years ago used CFLAGS only. This document still recommends it https://www.netbsd.org/docs/pkgsrc/configuring.html

I then found COPTS and CPUFLAGS in man mk.conf. It's not clear to me if that is only used for building the kernel and userland or also for pkgsrc. Sensucht94 also uses CPUFLAGS in his fancy /etc/mk.conf file http://daemonforums.org/showthread.php?t=11326


My ultimate goal is to rebuild pkgsrc with debug symbols so I can analyze core files.

What I have now in /etc/mk.conf

Code:
CPUFLAGS+=              -march=native
COPTS+=                 -g -O2 -pipe
CFLAGS+=                -g
This results in

Code:
/usr/pkgsrc/graphics/xli# make show-var VARNAME=COPTS
-g -O2 -pipe
/usr/pkgsrc/graphics/xli# make show-var VARNAME=CFLAGS
-O2 -g -D_FORTIFY_SOURCE=2
/usr/pkgsrc/graphics/xli# make show-var VARNAME=CPUFLAGS
-march=native

/usr/pkgsrc/graphics/xli# make clean; make

/usr/pkgsrc/graphics/xli# gdb /var/tmp/pkgsrc/graphics/xli/work/xli-2005-02-27/xli
...
Reading symbols from /var/tmp/pkgsrc/graphics/xli/work/xli-2005-02-27/xli...
(No debugging symbols found in /var/tmp/pkgsrc/graphics/xli/work/xli-2005-02-27/xli)
Reply With Quote