Tuesday, December 6, 2011

FreeBSD Optimizations /etc/make.conf

The file make.conf contains system-wide settings that will apply to every build using make and the standard sys.mk file. The purpose of make.conf is to control the compilation of the FreeBSD sourcesdocumentation, and ports.
The system build procedures occur in the following areas: the worldthe kerneldocumentation and ports. Variables set in make.conf may be applicable in one, two, or all four of these areas. In addition, control variables can be specified for a particular build via the -D option of make or in environment.
Here is a typical make.conf :
CPUTYPE?=nocona
CFLAGS=-O2 -pipe -fno-strict-aliasing
COPTFLAGS=-O2 -pipe -funroll-loops -ffast-math -fno-strict-aliasing
KERNCONF=BSD GENERIC
OPTIMIZED_CFLAGS=YES
WITHOUT_X11=YES
BUILD_OPTIMIZED=YES
WITH_CPUFLAGS=YES
WITH_OPTIMIZED_CFLAGS=YES
WITHOUT_DEBUG=YES
BUILD_STATIC=YES
NO_PROFILE=YES
NO_INET6=YES
CPUTYPE specifies your processor type so that the compiler will produce the optimized binary code for your specific processor as well as modifying the value of CFLAGS and COPTFLAGS to contain the appropriate optimization directive togcc.
A list of supported processors can be found in the default make.conf file in /usr/share/examples/etc/make.conf.
Currently the following CPU types are recognized:
Intel x86 architecture :
AMD CPUs :
 opteron athlon64 athlon-mp athlon-xp athlon-4 athlon-tbird athlon k8 k6-3 k6-2 k6 k5
Intel CPUs :
 core2 core nocona pentium4m pentium4 prescott pentium3m pentium3 pentium-m pentium2 pentiumpro pentium-mmx pentium i486 i386
Via CPUs :
 c3 c3-2
Alpha/AXP architecture : ev67 ev6 pca56 ev56 ev5 ev45 ev4
AMD64 architecture :
 opteron, athlon64, nocona, prescott, core2
Intel ia64 architecture
 : itanium2, itanium
The CFLAGS variable indicates what parameters should be passed to gcc when compiling typical programs such as ports or when building the whole operating system (i.e. make buildworld ). The COPTFLAGS variables only applies to kernel builds.
The automatic setting of CFLAGS and COPTFLAGS may be overridden using the NO_CPU_CFLAGS and NO_CPU_COPTFLAGS variables.
The KERNCONF controls which kernel configurations will be built and installed. The first will be installed and used as the default kernel (BSD) .
Everything else here is some defaults to be used mostly for ports. They can be found by looking into ports Makefile or the default make.conf file.
BUILD_OPTIMIZED is set to enable compiler optimizations. Use it if you need speed.
BUILD_STATIC is set to build static versions of the binaries. Use it if you need even more speed.
WITHOUT_DEBUG is set to disable debug.
NO_PROFILE is set to avoid compiling profiled libraries.
The NO_INET6 setting is used to disable IPv6 networking for programs and libraries.
Keep in mind that anything you add to /etc/make.conf is also used every time you run make, so it is a good idea to set them to something sensible for your system.

make.conf

# make.conf

# The CPUTYPE variable specifies your processor type so that the compiler will produce the optimized binary code for your specific processor.
# A list of supported processors can be found in the /usr/share/examples/etc/make.conf file.
# Currently the following CPU types are recognized:
# Intel x86 architecture:
# (AMD CPUs) opteron athlon64 athlon-mp athlon-xp athlon-4 athlon-tbird athlon k8 k6-3 k6-2 k6 k5
# (Intel CPUs) core2 core nocona pentium4m pentium4 prescott pentium3m pentium3 pentium-m pentium2 pentiumpro pentium-mmx pentium i486 i386
# (Via CPUs) c3 c3-2
# Alpha/AXP architecture: ev67 ev6 pca56 ev56 ev5 ev45 ev4
# AMD64 architecture: opteron, athlon64, nocona, prescott, core2
# Intel ia64 architecture: itanium2, itanium
CPUTYPE?=nocona

# The CFLAGS variable specifies any additional compiler options that you want to pass to the compilers.
# These additional settings mostly deal with the performance of the compiling process or that of the output binary code.
# A typical CFLAGS variable would look like this: CFLAGS= -O2 -pipe
CFLAGS=-O2 -pipe -fno-strict-aliasing
COPTFLAGS=-O2 -pipe -funroll-loops -ffast-math -fno-strict-aliasing

# Kernel configuration name
KERNCONF=BSD

# By default, when you build a custom kernel, all kernel modules will be rebuilt as well.
# If you want to update a kernel faster or to build only custom modules, uncomment next line
#MODULES_OVERRIDE = linux acpi sound/sound sound/driver/ds1 ntfs

OPTIMIZED_CFLAGS=YES
WITHOUT_X11=YES
BUILD_OPTIMIZED=YES
WITH_CPUFLAGS=YES
WITHOUT_DEBUG=YES
WITH_OPTIMIZED_CFLAGS=YES
NO_PROFILE=YES
BUILD_STATIC=YES
NO_INET6=YES

WITH_IPV6=NO
WITHOUT_IPV6=YES

BOOTWAIT=0
#BATCH=yes

# Common settings that are applied to all ports in hope to do some good.
#A4=yes
#PAPERSIZE=a4
#WITH_CUPS=yes
#CUPS_OVERWRITE_BASE=yes
#WITHOUT_ARTS=yes
#WITH_MOZILLA=firefox
#WITH_GECKO=firefox
#WITHOUT_DEBUG=yes
#WITH_GTK2=yes
#WITH_FAM_SYSTEM=fam
#WITH_XFT=yes

#NO_SENDMAIL=TRUE
#NO_MAILWRAPPER=TRUE # do not build the mailwrapper(8) MTA selector
#NO_GAMES=TRUE
#MAKE_IDEA=NO
#COMPAT22=yes
#COMPAT3X=yes
#COMPAT4X=yes
#USA_RESIDENT= NO
#ENABLE_SUIDPERL=TRUE

Reference:

No comments: