summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2023-10-05 22:49:19 +0100
committerLeah Rowe <leah@libreboot.org>2023-10-05 22:51:05 +0100
commit9d419e77a0621ddf8398edecb40ddedc3388dc42 (patch)
tree393175c361643f1ada2c833acb57109b84d58f1b /include
parent106841024a5d744768734def462387648d473014 (diff)
handle/make/*: unified main() function
Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'include')
-rw-r--r--include/make.sh30
1 files changed, 30 insertions, 0 deletions
diff --git a/include/make.sh b/include/make.sh
new file mode 100644
index 00000000..697c40d2
--- /dev/null
+++ b/include/make.sh
@@ -0,0 +1,30 @@
+# SPDX-License-Identifier: GPL-3.0-or-later
+# SPDX-FileCopyrightText: 2023 Leah Rowe <leah@libreboot.org>
+
+main()
+{
+ while getopts b:m:u:c:x: option
+ do
+ _flag="${1}"
+ 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
+}
+
+fail()
+{
+ [ -z "${codedir}" ] || ./handle make file -c "${codedir}" || :
+ err "${1}"
+}