Files
yait/build-aux/compile
2025-11-04 13:58:37 -05:00

64 lines
1.3 KiB
Bash
Executable File

#!/bin/sh
# SPDX-License-Identifier: BSD-3-Clause
me=$0
scriptversion="1.0.0"
version="$me $scriptversion
Copyright (C) 2025 GCK.
This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law."
usage="\
Usage: $me [OPTION]...
Compile wrapper for GCK distributions
Options:
-R force re-compile everything
--help print this help and exit
--version output version information
Automatically passes arugments to 'configure'"
rebuild=
while test $# -gt 0; do
case $1 in
--help) echo "$usage"; exit 0;;
--version) echo "$version"; exit 0;;
-R) rebuild=true ;;
-*)
echo "$0: Unknown option '$1'." >&2
echo "$0: Try '--help' for more information." >&2
exit 1;;
esac
shift
done
if [ -f ./config.mak ] && [ -z "$rebuild" ]; then
echo "$0: reusing old 'config.mak'"
else
if [ ! -x ./configure ]; then
echo "$0: 'configure' not found or not executable" >&2
exit 1
fi
echo "$0: configuring $(basename "$(git rev-parse --show-toplevel)")"
./configure "$@"
if [ $? -ne 0 ]; then
echo "error: configure failed" >&2
exit 1
fi
fi
echo "$0: starting build"
make -j"$(nproc)"
if [ $? -ne 0 ]; then
echo "error: build failed" >&2
exit 1
fi
echo "$0: finish"