tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: conditionals for platform-specific MAKE_ENV options



> On Jul 24, 2019, at 7:23 AM, maya%NetBSD.org@localhost wrote:
> 
> On Tue, Jul 23, 2019 at 07:35:31AM -0600, Brook Milligan wrote:
>> I am trying to make a package that has the following notes about compiling:
>> 
>> - If you see compilation errors, try make sse2only=1 to disable SSE4 code.
> 
> With this comment I suspect they have feature-detection code, but
> include this in case someone is building with a very old compiler that
> can't do some shiny AVX thing.
> 
> So, if the default compiler you have works with it without
> needing to specify any additional compiler flags and no use of
> -march=native or -mcpu=veryshiny, I would ignore this comment.

To follow up on this thread, I have decided to try the following.  

The Makefile has the following bits for the arm-related flags.  I cannot test this, so I would appreciate confirmation that this is correct (or suggestions).

.if !empty(MACHINE_ARCH:Mearmv[678])
MAKE_ENV+=	arm_neon=1
.endif

.if !empty(MACHINE_ARCH:Maarch64)
MAKE_ENV+=	aarch64=1
.endif

The contents of options.mk are the following:

PKG_OPTIONS_VAR=	PKG_OPTIONS.minimap2
PKG_SUPPORTED_OPTIONS+=	sse4

.include "../../mk/bsd.options.mk"

###
### Use SSE4 instructions
###
.if !empty(PKG_OPTIONS:Msse4)
# SSE4 instructions are the default
.else
MAKE_ENV+=	sse2only=1
.endif

This allows users to select SSE4, but the default is SSE2 only.

Please let me know if I have missed anything or chosen incorrectly.

Thanks,
Brook


Home | Main Index | Thread Index | Old Index