Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 2 Mar 2017 08:29:31 -0700
From:      Alan Somers <asomers@freebsd.org>
To:        Dimitry Andric <dim@freebsd.org>
Cc:        Mingo Rrubioer <mingorrubioer@gmail.com>, FreeBSD CURRENT <freebsd-current@freebsd.org>
Subject:   Re: CFLAGS for certain ports
Message-ID:  <CAOtMX2jrpVn-i_8nWHNBJpLcYPmgu-zWJkqK%2BMN2pTvRXepJWA@mail.gmail.com>
In-Reply-To: <D8CD355B-7B1D-48FF-8C3D-BC483F51F149@FreeBSD.org>
References:  <CAB%2BN1g3ZFvkKqye45wYQg=JovByFb=wuOXzFvf9nuk2z6SwckQ@mail.gmail.com> <D8CD355B-7B1D-48FF-8C3D-BC483F51F149@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Mar 2, 2017 at 5:58 AM, Dimitry Andric <dim@freebsd.org> wrote:
> On 2 Mar 2017, at 12:02, Mingo Rrubioer <mingorrubioer@gmail.com> wrote:
>>
>> I would like to see how well FreeBSD does as a workstation OS in the
>> HPC world due to its stability and reliability, as well as LLVM/clang.
>> I would like to know if FreeBSD has something similar to Gentoo's
>> /etc/portage/make.conf file and /etc/portage/package.use/* files in
>> order to compile certain ports with certain compiler flags.
>
> It doesn't, though it would certainly be nice to have something like it
> at some point.  The current idiom is to put something similar to the
> following in your /etc/make.conf:
>
> .if ${.CURDIR:M/usr/ports/foo/bar}
> CFLAGS+= [... flags for the foo/bar port ...]
> .endif
>
> .if ${.CURDIR:M/usr/ports/what/ever}
> CFLAGS+= [... flags for the what/ever port ...]
> .endif

Actually, you can enable options on a per-port basis by creating a
file named /var/db/ports/<category>_<portname>/options.  Those are the
files that get created whenever you do "make config" in a port
directory.  It's usually easiest to create them interactively just by
doing "make config" though.

>
>
>> Regarding LLVM/clang, I've been reading the documentation and found
>> these flags: -arch=<whatever>, -march=<whatever>, -mcpu=<whatever>,
>> --target=<whatever>, target-cpu <whatever>. I'm not quite sure which
>> one would be the one to use. In case someone wants to know, my initial
>> play/test machine has this processor:
>>
>> CPU: Intel(R) Core(TM) i7-3820 CPU @ 3.60GHz (3600.11-MHz K8-class CPU)
>>  Origin="GenuineIntel"  Id=0x206d7  Family=0x6  Model=0x2d  Stepping=7
>>
>> And I'm currently running: 11.0-RELEASE-p8.
>>
>> So I imagine I should use something like CFLAGS+= -march=corei7-avx
>> -march=sandybridge -target-cpu. Is that correct?
>
> Don't specify -march or -mcpu directly, but add the following line to
> /etc/make.conf:
>
> CPUTYPE?= native
>
> This will take care of everything automatically.  See also make.conf(5).
>
> -Dimitry
>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAOtMX2jrpVn-i_8nWHNBJpLcYPmgu-zWJkqK%2BMN2pTvRXepJWA>