svn commit: r212979 - in head: gnu/lib/libobjc sys/boot/i386/boot2 sys/boot/pc98/boot2

Dimitry Andric dim at FreeBSD.org
Fri Oct 1 21:00:27 UTC 2010


On 2010-10-01 19:54, Anonymous wrote:
>> -.if ${CC:T:Mclang} == "clang"
>> -CC=gcc
>> -.endif
>> +CC:=${CC:C/^(.*\/)?clang$/gcc/1}
>
> How about clearing some user-defined variable together with the substitution
>
>    CLANG_FLAGS = # set to empty value
>    CC := ${CC:C/^(.*\/)?clang$/gcc/1}
>
> in which user can store clang-specific flags (via src.conf), e.g.
>
>    CC = clang ${CLANG_FLAGS}
>    CLANG_FLAGS = -Qunused-arguments # too much noise for `make -s' build
>
> or
>
>    CPUTYPE ?= native
>    CLANG_FLAGS = -mno-sse4 # don't feed as(1) unknown opcodes
>
> Otherwise, substitution occurs too late and gcc(1) chokes on unknown
> options.

Adding your clang-specific flags to CC will not work, because the

CC:=${CC:C/^(.*\/)?clang$/gcc/1}

expression explicitly does not filter out any command line arguments.
This is needed for the build32 stage on amd64, for instance.

Note the -Qunused-arguments flags is really just a quick hack, to stop
Clang from warning about unused arguments.  It reduces warnings during
compilation, but the warnings should in fact be fixed, by not providing
redundant arguments anymore.  However, it will take a while to do this
properly.

The particular case of libobjc is special, because it is the only
Makefile that both modifies CC, and takes the default CFLAGS from
make.conf.  The only other cases where we *must* compile with gcc for
now, are boot2 for i386 and pc98, but these set their CFLAGS to a
hardcoded value.

A solution could be to always use hardcoded CFLAGS for libobjc.
Otherwise, we could check for a GCC_CFLAGS in libobjc's Makefile, and
substitute these for the regular CFLAGS, iff clang is used to build
world.  Does that sound acceptable?


More information about the svn-src-head mailing list