# A FreeBSD MATRIX
# $Id: M_freebsd,v 1.23 2021/03/08 08:55:17 tlaronde Exp $
#
# Copyright 2004, 2016--2017, 2019, 2021 Thierry LARONDE <tlaronde@polynum.com>
# Public Domain. NO GUARANTEES!

#----- MATRIX environment dependent
MATRIX="freebsd"
MATRIX_ARCH=${MATRIX_ARCH:-$(uname -p)}
MATRIX_MACHINE=${MATRIX_MACHINE:-$(uname -m)}
MATRIX_RELEASE=${MATRIX_RELEASE:-$(uname -r)}
MATRIX_TYPE=unix
MATRIX_NCPU=${MATRIX_NCPU:-$(sysctl -n hw.ncpu || echo 1)}
MATRIX_SUBTYPE=GENERIC

M_TOOLS_REQUIRED=

# If cross-compiling, there is perhaps a prefix for the target libes.
#
M_CROSS_PATH_PREFIX=${M_CROSS_PATH_PREFIX:-""}

# Symbolic links are supported.
M_FSLINK="ln -sfh"

MATRIXRMDIR="rmdir"

#----- There shall be a compile environment

if test "x${RK_COMPILE_ENV:-}" = x; then
	if test ${MATRIX_RELEASE%%.*} -ge 10; then
		RK_COMPILE_ENV=clang
	else
		RK_COMPILE_ENV=gcc
	fi
fi

include C_$RK_COMPILE_ENV

# The names are set by the TARGET, but the search is made on the
# matrix.
#
CLIB=$(rk_which_lib_of $CLIB)
MATHLIB=$(rk_which_lib_of $MATHLIB)
YACCLIB=$(rk_which_lib_of $YACCLIB)
LEXLIB=$(rk_which_lib_of $LEXLIB)

if test "x$ICONVLIB" != x; then
	ICONVLIB=$(rk_which_lib_of $ICONVLIB)
fi
