summaryrefslogtreecommitdiff
path: root/project/config/cfghost.sh
blob: c862e2b2d2d45e990b85a22f50d6e62ee1873bba (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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# cfghost.sh: map the target or native hosts, as reported by
# the -dumpmachine mechanism of their respective compilers,
# to project-specific hosts.

# internal variables of interest:
# mb_internal_cchost:  the host reported by -dumpmachine
# mb_internal_cfghost: the unified, project-specific host name
# mb_internal_cfgtype: the type of host being test (target/native)

cfghost_internal_test()
{
	if [ -z "$mb_internal_cchost" ]; then
		error_msg 'cfghost_internal_test(): $mb_internal_cchost is empty.'
		exit 2
	fi

	if [ -d "$mb_project_dir/config/$mb_internal_cchost" ]; then
		mb_internal_cfghost=$mb_internal_cchost
	fi

	if [ -z $mb_internal_cfghost ]; then
		case $mb_internal_cchost in
			*-linux | *-linux-* )
				mb_internal_cfghost='linux' ;;

			*-midipix | *-midipix-* )
				mb_internal_cfghost='midipix' ;;

			* )
				mb_internal_cfghost='any-host' ;;
		esac
	fi

	if [ $mb_internal_cfgtype = 'target' ]; then
		mb_cfghost="$mb_internal_cfghost"
	else
		mb_native_cc_cfghost="$mb_internal_cfghost"
	fi
}

cfghost_set_target_cfghost()
{
	mb_internal_cchost="$mb_cchost"
	mb_internal_cfghost="$mb_cfghost"
	mb_internal_cfgtype='target'

	cfghost_internal_test
}

cfghost_set_native_cfghost()
{
	mb_internal_cchost="$mb_native_cc_host"
	mb_internal_cfghost="$mb_native_cc_cfghost"
	mb_internal_cfgtype='native'

	cfghost_internal_test
}