handle/make/*: unified main() function

Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
Leah Rowe
2023-10-05 22:49:19 +01:00
parent 106841024a
commit 9d419e77a0
4 changed files with 40 additions and 42 deletions
+2 -20
View File
@@ -9,6 +9,7 @@ set -u -e
. "include/err.sh"
. "include/option.sh"
. "include/make.sh"
read projectname < projectname
read our_version < version
@@ -20,26 +21,7 @@ eval "$(setvars "" arch cfgsdir codedir config config_name crossgcc_ada mode \
tmpclean="$(mktemp -d -t makeclean.XXXXXXXXXX)"
main()
{
while getopts b:m:u:c:x: option
do
case "${1}" in
-b) mode="all" ;;
-u) mode="oldconfig" ;;
-m) mode="menuconfig" ;;
-c) mode="distclean" ;;
-x) mode="crossgcc-clean" ;;
*) fail "Invalid option" ;;
esac
shift; project="${OPTARG}"; shift
done
[ -z "${mode}" ] && fail "mode not given (-m, -u, -b, -c or -x)"
[ -z "${project}" ] && fail "project name not specified"
handle_dependencies $@
handle_targets
}
# main() is in include/make.sh
handle_dependencies()
{