summaryrefslogtreecommitdiff
path: root/include/make.sh
blob: 697c40d27a3bdc1011bf79d067088c5d3f172c08 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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}"
}