From owner-freebsd-ports@FreeBSD.ORG Thu Nov 29 16:46:47 2012 Return-Path: Delivered-To: freebsd-ports@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 59360576; Thu, 29 Nov 2012 16:46:47 +0000 (UTC) (envelope-from lifanov@mail.lifanov.com) Received: from mail.lifanov.com (mail.lifanov.com [206.125.175.12]) by mx1.freebsd.org (Postfix) with ESMTP id 21F3F8FC14; Thu, 29 Nov 2012 16:46:47 +0000 (UTC) Received: from [10.0.0.206] (cpe-174-109-075-092.nc.res.rr.com [174.109.75.92]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mail.lifanov.com (Postfix) with ESMTPSA id 5795519ECC4; Thu, 29 Nov 2012 16:46:40 +0000 (UTC) Message-ID: <50B7916E.4070102@mail.lifanov.com> Date: Thu, 29 Nov 2012 11:46:38 -0500 From: Nikolai Lifanov User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: Alberto Villa Subject: Re: How to handle WITH_CLANG_IS_CC in ports References: <20121125114918.GA35966@oshi.local> <20121127162737.GB1790@oshi.local> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Tobias Rehbein , freebsd-ports@freebsd.org X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Nov 2012 16:46:47 -0000 On 11/29/2012 10:12 AM, Alberto Villa wrote:> On Tue, Nov 27, 2012 at 5:27 PM, Tobias Rehbein 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 > 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