Date: Fri, 01 Oct 2010 23:00:33 +0200 From: Dimitry Andric <dim@FreeBSD.org> To: Anonymous <swell.k@gmail.com> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r212979 - in head: gnu/lib/libobjc sys/boot/i386/boot2 sys/boot/pc98/boot2 Message-ID: <4CA64BF1.9080401@FreeBSD.org> In-Reply-To: <86mxqx7q9o.fsf@gmail.com> References: <201009212141.o8LLfjHX007646@svn.freebsd.org> <86mxqx7q9o.fsf@gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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?
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4CA64BF1.9080401>