#	libmxlinux -- the NetBSD interfaces glibc does not have, for every port
#	of mobile/userland (docs/NETBSD-USERLAND.md section 4)
#
# Built like src/tools/compat builds libnbcompat (HOSTLIB, bsd.hostlib.mk),
# with the phone's compiler, by the mx-lib step of ../../Makefile; not
# installed -- mk/mx.prog.mk links it from its object directory and forces
# include/mxlinux.h into every compile.
#
# NetBSD's own sources where they run on glibc unchanged, through .PATH;
# Linux code of ours (mx_*.c) only where the kernel's or glibc's view is
# needed.  A new item: its source, its declaration in include/mxlinux.h with
# the NetBSD header line it stands in for, and a line in AGENTS.md.

HOSTLIB=	mxlinux

.include <bsd.hostinit.mk>

# libnbcompat's configuration (nbtool_config.h, compat_defs.h): the same
# environment the ports compile in; its library is linked by the ports.
MX_COMPATOBJ=	${MX_DESTDIR:H}/obj/src/tools/compat
NOCOMPATLIB=	yes
COMPATLIB_UNINSTALLED=yes
COMPATLIB_NO_LIB=yes
.include "${MX_COMPATOBJ}/defs.mk"

.PATH:		${NETBSDSRCDIR}/lib/libmxlinux \
		${NETBSDSRCDIR}/common/lib/libc/stdlib \
		${NETBSDSRCDIR}/lib/libc/gen

# ours
SRCS=		mx_signame.c mx_fgetwln.c mx_locale.c mx_progname.c
# NetBSD's, unchanged
SRCS+=		getopt.c
SRCS+=		signalname.c signalnumber.c signalnext.c
SRCS+=		humanize_number.c dehumanize_number.c getbsize.c

HOST_CPPFLAGS+=	-include nbtool_config.h -I${NETBSDSRCDIR}/lib/libmxlinux -DMX_PORT_FRAME -include mxlinux.h

.include <bsd.hostlib.mk>
