Files
makronix/mobile/userland/Makefile
T
lotherkandClaude Opus 5.5 081646b002 mobile: userland: libmxlinux, and SIGINFO is SIGPWR system-wide
userland/lib/mxlinux: what NetBSD's headers and libc have and glibc lacks,
in one place instead of per port.  NetBSD's own sources where they run on
glibc unchanged (getopt, signalname/signalnumber/signalnext,
humanize_number, dehumanize_number, getbsize), ours where Linux's view is
needed (sys_signame from sigabbrev_np, fgetwln, LC_C_LOCALE);
include/mxlinux.h with the NetBSD header line each item stands in for.

The frame forces nbtool_config.h and mxlinux.h into every port and links
libmxlinux.a ahead of libc, so every program gets NetBSD's getopt (glibc's
permutes argv: env -i A=1 failed).  SIGINFO is SIGPWR on Makronix,
system-wide (Konrad, 2026-11-11), named INFO in sys_signame: kill -INFO
makes sleep print NetBSD's "Between 2 and 3 seconds left".

The ports shrink to what is theirs: 23 are two lines again; stty keeps its
termios names, sleep -lm, fold _XOPEN_SOURCE, dirname MAN=.  Clean rebuild
28/28, no warning; tests 28/28 under qemu and on the phone
(build/logs/userland-{qemu,phone}-mxlinux-2026-11-11.log).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 18:35:19 +00:00

51 lines
1.7 KiB
Makefile

# mobile/userland -- the NetBSD programs of the phone
#
# docs/NETBSD-USERLAND.md (the plan), docs/PORTING-USERLAND.md (how to port
# one program). Run through ../tools/mxmake.sh; from mobile/ that is
# make userland [PROG=cat]
#
# The steps, in order:
# mx-dirs lay down the destdir hierarchy (mk/mx.dist) with nbmtree --
# NetBSD's install(1) creates no directories; build.sh's
# distrib-dirs does the same with src/etc/mtree/NetBSD.dist
# mx-compat src/tools/compat (libnbcompat) for the phone, uninstalled, in
# its object directory; every port links it
# mx-lib lib/mxlinux (libmxlinux): the NetBSD interfaces glibc lacks,
# NetBSD's own sources where they run; every port links it
# the ports every directory here with a Makefile, except mk/ -- found, not
# listed, so two agents adding two ports never edit one file;
# PROG=<dir> builds one
.include <bsd.own.mk>
.if defined(PROG) && !empty(PROG)
MX_PORTS= ${PROG}
.else
MX_PORTS!= cd ${.CURDIR} && ls -d */Makefile 2>/dev/null | \
sed -e 's,/Makefile$$,,' -e '/^mk$$/d'
.endif
all: mx-dirs mx-compat mx-lib mx-ports
mx-dirs: .PHONY
mkdir -p ${MX_DESTDIR}
${TOOL_MTREE} -N ${NETBSDSRCDIR}/etc -deU -f ${.CURDIR}/mk/mx.dist \
-p ${MX_DESTDIR} >/dev/null
mx-compat: .PHONY
cd ${NETBSDSRCDIR}/tools/compat && ${MAKE} obj && ${MAKE} dependall
mx-lib: .PHONY mx-compat
cd ${.CURDIR}/lib/mxlinux && ${MAKE} obj && ${MAKE} dependall
mx-ports: .PHONY mx-dirs mx-compat mx-lib
.for p in ${MX_PORTS}
@echo "===> userland ${p}"
cd ${.CURDIR}/${p} && ${MAKE} obj && ${MAKE} dependall && ${MAKE} install
.endfor
clean cleandir: .PHONY
.for p in ${MX_PORTS}
cd ${.CURDIR}/${p} && ${MAKE} ${.TARGET}
.endfor