Subject: Re: MAKEOPTS - Setting in globally in NetBSD?
To: Andreas Hallmann <hallmann@hallhard.darktech.org>
From: Sean Hafeez <sahafeez@zaphodb.org>
List: tech-pkg
Date: 09/05/2004 09:16:08
Thanks for the info. I will include it in my setting. However, it i was  
not what I was looking for. I do not suppose you know how to tell  
NetBSD the number of compile jobs to run at once? It is the -jX  
switching in make I believe. I have 4 cpus and want make sure that a  
build uses as many as it can.

Take a look at Section 5.e at the bottom of the section, Code Listing  
18. (From Gentoo Linux)

http://www.gentoo.org/doc/en/handbook/handbook-x86.xml? 
full=1#book_part1_chap5

How do I do this in NetBSD?

On Sep 5, 2004, at 1:38 AM, Andreas Hallmann wrote:

> Sean Hafeez wrote:
>> Is there anyway to set a global MAKEOPTS in NetBSD? Its in a config  
>> file under Gentoo Linux but I have not been able to find something  
>> that is the same in NetBSD. I have a box with 4 CPU's so I would like  
>> MAKEOPTS=-j5 set for any compile job (like stuff in pkgsrc).
>> Thanks!
>
> Have a look at the following snipset. You can place it at the begining
> of /etc/mk.conf .
>
> I use it to switch compilation options between sparc cpu's.
>
> So seting 'BUILDID=v8' turns on CFLAGS for v8 optimisations.
>
> It builds around the package CPUFLAGS. (Install it)
>
> I found it useful this way, since most packages respect CPUFLAGS now.
> So i don't have to worry about the details in those 5000 packages.
>
> Even so there are some candidates like perl with a braindead  
> buildsystem
> which don't apply CFLAGS. But whenever someone work on this, you will  
> get it for free.
>
> P.S.: Most useful is seting BUILDID in your profile to a reasonable  
> default.
>
>
>
> ----snip------snip------snip------snip-----...
> #OPTS-START
> #
> # This peace combines the benefits of cpuflags and buildid in mk.conf  
> of netbsd
> #
> #Note, if you use the BUILDID stuff I added to the build system a while
> #ago, you can make this even more fine-grained.  For example, if you  
> have
> #both SPARC v7 and SPARC v8 machines, you can set the BUILDID when you
> #build the tree:
> #
> #       ./build.sh -m sparc -B v8 ...
> #
> #creating separate obj dirs, and then test like:
>
> .if defined(USE_GCC2)
> .sinclude "/usr/pkg/share/examples/gcc-2.95.3/mk.conf"
> .endif
>
> .if defined(USE_GCC3)
> .sinclude "/usr/pkg/share/examples/gcc-3.3/mk.conf"
> .endif
>
> .if ${MACHINE_ARCH} == "sparc"
> .if defined(BUILDID)
>
> .if ${BUILDID} == "v8"
> CPU_FLAGS=-pipe -mcpu=v8 -mtune=supersparc
> _BUILDID=-v8
> .elif ${BUILDID} == "v7"
> CPU_FLAGS=-pipe -mcpu=v7 -mtune=cypress
> _BUILDID=-v7
> .else
> _BUILDID=""
> .endif
>
> .endif # defined BUILDID
> .endif # sparc arch
>
> # include cpuflags.mk which reuses CPU_FLAGS if set by other means
> # so we keep pace with cpuflags
> /etc/mk.conf
> .sinclude "/usr/pkg/share/mk/cpuflags.mk"
> #OPTS-END