lme@ said:Please don't use build optimizations in make.conf. The standard compile options are already chosen wisely.
killasmurf86 said:why does ppl, like writing default flags to make.conf?
Like it speeds things up?
I have tried Gentoo linux to many times, to tell you this:
Forget about it. It just ain't worth.
not to mention, that your flags didn't improve anything at all
From /usr/share/mk/sys.mk:Weinter said:CPUTYPE?= k8
CFLAGS+= -O2 -pipe
COPTFLAGS+= -O2 -pipe
MAKEOPTS+= -j3
.if defined(%POSIX)
CC ?= c89
CFLAGS ?= -O
.else
CC ?= cc
CFLAGS ?= -O2 -fno-strict-aliasing -pipe
.endif
CXXFLAGS+=-Wno-deprecated
.if ${CC} == "icc"
COPTFLAGS?= -O
.else
. if defined(DEBUG)
_MINUS_O= -O
. else
_MINUS_O= -O2
. endif
. if ${MACHINE_ARCH} == "amd64"
COPTFLAGS?=-O2 -frename-registers -pipe
. else
COPTFLAGS?=${_MINUS_O} -pipe
. endif
. if !empty(COPTFLAGS:M-O[23s]) && empty(COPTFLAGS:M-fno-strict-aliasing)
COPTFLAGS+= -fno-strict-aliasing
. endif
.endif
.if !defined(NO_CPU_COPTFLAGS)
. if ${CC} == "icc"
COPTFLAGS+= ${_ICC_CPUCFLAGS:C/(-x[^M^K^W]+)[MKW]+|-x[MKW]+/\1/}
. else
COPTFLAGS+= ${_CPUCFLAGS}
. endif
.endif
Weinter said:This is my make.conf so far everything works
CPUTYPE?= k8
CFLAGS+= -O2 -pipe
COPTFLAGS+= -O2 -pipe
MAKEOPTS+= -j3
################################################################################
# cpu type
CPUTYPE=nocona
# ports compilation flag
CFLAGS= -O2 -fno-strict-aliasing -pipe
CXXFLAGS+= -fconserve-space
# shell
MAKE_SHELL=sh
# kernle compilation flag
COPTFLAGS= -O2 -pipe
# kernel config
KERNCONF=MYKERNEL
# install command
INSTALL=install -C
# do not build modules with the kernel
NO_MODULES=true
# avoid compiling profiled libraries
NO_PROFILE=true
################################################################################
# for update
SUP_UPDATE=true
SUP= /usr/bin/csup
SUPFLAGS= -g -L 2
SUPHOST= cvsup5.cn.FreeBSD.org
SUPFILE= /usr/share/examples/cvsup/standard-supfile
PORTSSUPFILE= /usr/share/examples/cvsup/ports-supfile
################################################################################
# do not update documentation
NO_DOCUPDATE=true
################################################################################
# for gui application
WITH_GTK2=yes
################################################################################
# set server for distfiles
#MASTER_SITE_OVERRIDE?=http://ports.hshh.org/${DIST_SUBDIR}/
#MASTER_SITE_OVERRIDE?=http://ports.cn.freebsd.org/${DIST_SUBDIR}/
################################################################################
# for ccache
.if (!empty(.CURDIR:M/usr/src*) || !empty(.CURDIR:M/usr/obj*)) && !defined(NOCCACHE)
CC=/usr/local/libexec/ccache/world-cc
CXX=/usr/local/libexec/ccache/world-c++
.endif
# about ccache for "make buildworld"
# NOCCACHE=true
################################################################################
# added by use.perl 2008-08-22 20:04:44
PERL_VER=5.8.8
PERL_VERSION=5.8.8
################################################################################
Mel_Flynn said:This isn't very smart:
From /usr/share/mk/sys.mk:
Code:.if defined(%POSIX) CC ?= c89 CFLAGS ?= -O .else CC ?= cc CFLAGS ?= -O2 -fno-strict-aliasing -pipe .endif
So, CFLAGS is overridden by you:
-O2 without -fno-strict-aliasing is NOT supported on FreeBSD and will cause programs to miscompile or misbehave.
The only compiler flag that makes sense to put in /etc/make.conf is:
Code:CXXFLAGS+=-Wno-deprecated
As this gets rid of useless warnings about char to string conversions in c++ code.
COPTFLAGS is used by the kernel, as seen in /usr/src/sys/conf/kern.pre.mk. Nowhere else. Unless you're a kernel hacker who knows what he's doing, stay away from it. Here's how it's set up:
Code:.if ${CC} == "icc" COPTFLAGS?= -O .else . if defined(DEBUG) _MINUS_O= -O . else _MINUS_O= -O2 . endif . if ${MACHINE_ARCH} == "amd64" COPTFLAGS?=-O2 -frename-registers -pipe . else COPTFLAGS?=${_MINUS_O} -pipe . endif . if !empty(COPTFLAGS:M-O[23s]) && empty(COPTFLAGS:M-fno-strict-aliasing) COPTFLAGS+= -fno-strict-aliasing . endif .endif .if !defined(NO_CPU_COPTFLAGS) . if ${CC} == "icc" COPTFLAGS+= ${_ICC_CPUCFLAGS:C/(-x[^M^K^W]+)[MKW]+|-x[MKW]+/\1/} . else COPTFLAGS+= ${_CPUCFLAGS} . endif .endif
Weinter said:But i used += which adds to the compilation options not overwrite it?!
kamikaze said:Is this a contest in displaying the most nonsensical make.conf lines?
Seriously just set CPUTYPE?=<mycpu> and select OPTIMIZED_CFLAGS when an options dialogue offers it and you've done everything that makes sense.