Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 29 Nov 2012 11:46:38 -0500
From:      Nikolai Lifanov <lifanov@mail.lifanov.com>
To:        Alberto Villa <avilla@FreeBSD.org>
Cc:        Tobias Rehbein <tobias.rehbein@web.de>, freebsd-ports@freebsd.org
Subject:   Re: How to handle WITH_CLANG_IS_CC in ports
Message-ID:  <50B7916E.4070102@mail.lifanov.com>
In-Reply-To: <CAJp7RHY17pm_FNMn6vUHELU8FPBMhC0nWKVRYNPY3FRdpULUuA@mail.gmail.com>
References:  <20121125114918.GA35966@oshi.local> <CAJp7RHZuB2t=QAVs3QwAqz7T%2BMbwiL1mMz8o9u0C4S%2BBKX_3Lg@mail.gmail.com> <20121127162737.GB1790@oshi.local> <CAJp7RHY17pm_FNMn6vUHELU8FPBMhC0nWKVRYNPY3FRdpULUuA@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 11/29/2012 10:12 AM, Alberto Villa wrote:> On Tue, Nov 27, 2012 at 
5:27 PM, Tobias Rehbein <tobias.rehbein@web.de> 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
 > bsd.port.mk inclusion.
 > --
 > Alberto Villa, FreeBSD committer <avilla@FreeBSD.org>
 > http://people.FreeBSD.org/~avilla
 >

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

This logic:

setcc:

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

Or this logic:

setcc:

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

Then, in the Makefile, use it like this:

post-patch: setcc




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?50B7916E.4070102>