Options for make.conf

Well I'm a newcomer in FreeBSD, I come from GNU/Linux and I used Gentoo/Funtoo and Debian, my doubt is referent at options in the /etc/make.conf, I've this hardware:

CPU: Intel Pentium G645 (SandyBridge without AVX, AES extensions)
VIDEO: Intel HD 2000
RAM: 4 GB Ram
MB: AsRock H61-VG3

And this options on my actual /etc/make.conf

Code:
CPUTYPE=native
CFLAGS=-O2 -pipe -fomit-frame-pointer
CXXFLAGS=-O2 -pipe -fomit-frame-pointer
MAKE_JOBS_NUMBER=3
BUILD_OPTIMIZED=YES
WITH_CPUFLAGS=YES
WITH_OPTIMIZED_CFLAGS=YES
WITH_NLS=YES

My questions:

Use CPUTYPE=native is correct or problematic when use clang/llvm?

Some form for activate cpu extensions (mmx, mmxext, sse, sse2, sse3, ssse3, sse4_1, sse4_2, popcnt) using /etc/make.conf options for packages ports with support for this (ex. ffmpeg)?
 
CPUTYPE=native is usually fine.

However, around here we recommend not setting CFLAGS and CXXFLAGS. They generally do not give measurable performance improvements, but do cause mysterious problems. I'm not sure what happens when CFLAGS is set but it collides with WITH_OPTIMIZED_CFLAGS, but would expect CFLAGS to win and defeat the optimized settings.
 
In that case using CPUTYPE=native and WITH_OPTIMIZED_CFLAGS is sufficient for a good optimization for compile code on ports.

And in case for CPU extensions, I need select this optimizations for each port compiled?
 
Something to note about setting CFLAGS and other related flags in make.conf(5). You should never do that globally but restrict the settings to selected ports by using the following pattern (there is an example in/usr/share/examples/etc/make.conf along these lines):

Code:
.if ${.CURDIR:M*/irc/irssi-devel*}
WITH_DEBUG=YES
.endif

If you set compiler flags globally you're very likely to mess up something when the flags are applied where they shouldn't be and the compiler may still compile the code but generate faulty code that doesn't work.
 
Back
Top