Files
lbmk/mk
T
Leah Rowe 8822c56815 mk: make it completely generic
commands now fed from a file, include/common.sh
which in turn also includes other lib files

this makes mk completely generic, and means
that changes will now be completely in sync
with cbmk, ensuring a lack of merge conflicts,
though the file was already pretty small anyway.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-10 18:05:57 +01:00

59 lines
789 B
Bash
Executable File

#!/usr/bin/env sh
# SPDX-License-Identifier: GPL-3.0-or-later
# Copyright (c) 2020-2026 Leah Rowe <leah@libreboot.org>
# Copyright (c) 2022 Caleb La Grange <thonkpeasant@protonmail.com>
set -u -e
xrval=0
(
xbarg0="$0"
if [ "${xbarg0##*/}" = "$xbarg0" ]; then
xbarg0="`command -v "$xbarg0"`"
fi
xbcddir="`readlink -f "$xbarg0" 2>/dev/null`"
if [ -z "$xbcddir" ]; then
xbcddir="`realpath "$xbarg0" 2>/dev/null`"
fi
xbcddir="${xbcddir%/*}"
cd "$xbcddir" || exit 1
. "include/common.sh"
main()
{
cmd=""
if [ $# -gt 0 ]; then
cmd="$1"
shift 1
fi
if ! xeq main "$cmd" $xbcommands; then
return 0
fi
$cmd "$@"
set -u -e
return 1
}
main "$@" || exit 0
. "include/tree.sh"
trees "$@" || exit 0
x_ touch "$mkhelpercfg"
. "$mkhelpercfg"
$cmd
) || xrval=1
exit $xrval