Re: CLANG; still cc in use when building the WORLD with CLANG?

From: Dimitry Andric <dim_at_FreeBSD.org>
Date: Tue, 30 Aug 2011 19:58:54 +0200
On 2011-08-30 18:44, Alex Kuster wrote:
> Thanks for pointing out those details !
> This whole thing about make.conf&  src.conf is very confusing and gives the
> impression of something half ported ...

The only thing that is "half ported" at the moment, is an easy "use
clang to build world" switch.  This will be properly addressed after 9.0
is released.  As to the make.conf/src.conf confusion, it is very simple
really:

- make.conf is used for system-wide settings, applied to every build
   using make.

- src.conf is used for setting FreeBSD source tree settings, which are
   always of the form WITH_XXX or WITHOUT_XXX.  See src.conf(5) for a
   full list.  Any other "make" settings, such as CC, CFLAGS, etc, are
   better specified in make.conf, though the manpage does not tell you
   so explicitly.

Now, why do some settings, such as CFLAGS, in src.conf not always work
correctly?  Because src.conf is only read when bsd.own.mk is included
(implicitly or explicitly) in a Makefile, and this is *not* always done
at the start of the file.

On the other hand, make.conf is read from /usr/share/sys.mk, which is
automatically included before anything else is done.

Take, for example, the Makefile for cp(1), in /usr/src/bin/cp (I
prefixed line numbers for reference):

1: #       _at_(#)Makefile    8.1 (Berkeley) 5/31/93
2: # $FreeBSD: head/bin/cp/Makefile 192586 2009-05-22 15:56:43Z trasz $
3:
4: PROG=   cp
5: SRCS=   cp.c utils.c
6: CFLAGS+= -DVM_AND_BUFFER_CACHE_SYNCHRONIZED -D_ACL_PRIVATE
7:
8: .include <bsd.prog.mk>

At line 1, make will already have read make.conf, picking up settings
from it.  Suppose it picks up "CFLAGS=-foo".

At line 6, CFLAGS has several flags appended.  Its value will then
become "-foo -DVM_AND_BUFFER_CACHE_SYNCHRONIZED -D_ACL_PRIVATE".

At line 8, bsd.prog.mk is read, which (through bsd.own.mk) belatedly
reads src.conf.  If you have a setting such as "CFLAGS=-bar" in it, this
value will *override* the previous one, possibly having disastrous
consequences.
Received on Tue Aug 30 2011 - 15:58:57 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:17 UTC