How to handle WITH_CLANG_IS_CC in ports

Nikolai Lifanov lifanov at
Thu Nov 29 16:46:47 UTC 2012

On 11/29/2012 10:12 AM, Alberto Villa wrote:> On Tue, Nov 27, 2012 at 
5:27 PM, Tobias Rehbein <tobias.rehbein at> wrote:
 >> Is there any chance you turn this into a generic Mk macro?
 > I don't think so, it would mean running `cc --version` on every
 > inclusion.
 > --
 > Alberto Villa, FreeBSD committer <avilla at>

What I meant is to add something like a "setcc" target that port 
Makefiles (that need this) can call.

This logic:


     @if [ ! -z "`cc -v 2>&1|grep clang`" ] ; then \
         CC?= clang; \
     else \
         CC?= gcc; \

Or this logic:


     @if [ -z "$CC" ] ; then \
	CC=`cc -v 2>&1|\
	sed '/version/!d;s/.*\(clang\).*/\1/;s/.*\(gcc\).*/\1/'`

Then, in the Makefile, use it like this:

post-patch: setcc

More information about the freebsd-ports mailing list