make.conf in FreeBSD
I am type of person who likes to build everything from source code in FreeBSD to get better performance and other customizations. It has become a habit to play with ports tree and system source code and now I believe I have my own template for various server platforms.
One of the most important parts of each configuration template is the /etc/make.conf file. This is were you can change general behavior of the build system. This file is where you actually say which compiler optimizations should be used or what options has to be considered as defaults. Good news is that ports collection as well as the operating system itself honor these configuration.
Here is how a typical make.conf on one of my boxes look like:
CPUTYPE?=nocona
CFLAGS= -O2 -pipe -fno-strict-aliasing
COPTFLAGS= -O2 -pipe -funroll-loops -ffast-math -fno-strict-aliasing
KERNCONF= SERVER GENERIC
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
The CPUTYPE variable tells gcc to optimize generated binary code for specified processor. In this case I am using 64bit Xeon processor architecture and “nocona” is the correct CPUTYPE to use. You may want to use “pentium4” on a typical Intel P4 CPU. A list of possible CPUTYPE values can be found in the sample make.conf file located at /usr/share/examples/etc/make.conf.
The CFLAGS variable indicates what parameters should be passed to gcc compiler when compiling typical programs such as ports or when building the whole operating system (i.e. buildworld process). I have been using this for a few years now and I haven’t experienced any issues in generated binaries.
The COPTFLAGS variables only applies to kernel builds. So if you need special compiler optimization for kernel, this is the variable you should consider using.
The KERNCONF tells system to compile one or more kernels based on the existing configuration files. In this example I have two kernels, first is GENERIC which is the default kernel file and exists in all systems by default and the other is the customized kernel configuration file called SERVER that I use on my typical servers. Both kernels will be built when running “make kernel“. The first will be installed and used as the default kernel.
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 at /usr/share/examples/etc/make.conf.
7 Responses to make.conf in FreeBSD
Leave a Reply Cancel reply
Archives
- July 2011
- December 2010
- September 2010
- May 2009
- April 2009
- February 2009
- September 2008
- April 2008
- February 2008
- January 2008
- November 2007
- October 2007
- August 2007
- July 2007
- May 2007
- February 2007
- December 2006
- October 2006
- September 2006
- April 2006
- March 2006
- January 2006
- December 2005
- November 2005
- October 2005
- September 2005
- August 2005
- July 2005
- June 2005
- May 2005
- April 2005
- March 2005
- January 2005
- December 2004
- October 2004
- September 2004
- August 2004
- July 2004
- June 2004
- May 2004
- April 2004
- March 2004
- February 2004
- January 2004
- December 2003
- November 2003
- October 2003
- September 2003
- August 2003
- July 2003
- June 2003
- May 2003
- April 2003
- March 2003
- February 2003




[...] just posted a new article about make.conf in my other [...]
سلام
امیدوارم همیشه موفق باشی.
Thanks Babak! useful post!
Is there a way to tell make not to query the user with a sysinstall type screen? I’d like to have make accept all the defaults for each application. This way I can perhaps automate an install of a bunch of applications at once.
@argv
You mean suppression of the options dialog? There are several ways to do it, mainly by setting BATCH=yes. (e.g. in make.conf, or in your environment before running make.) Google it for more examples.
(i.e. http://sonicchicken.net/blog/wordpress/20090111/batch-port-install/)
Thanks Babak! useful very post!your book “Network Administration with FreeBSD 7″ too is very useful, I recommend to all.
Thanks Babak!