From 04aa65dc7c08631136f69217e04b407dfd274c8e Mon Sep 17 00:00:00 2001 From: midipix Date: Thu, 13 Dec 2018 03:09:46 -0500 Subject: project: added and integrated cfghost.sh, refactored cfgdefs.sh accordingly. --- project/config/cfghost.sh | 57 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 project/config/cfghost.sh (limited to 'project/config/cfghost.sh') diff --git a/project/config/cfghost.sh b/project/config/cfghost.sh new file mode 100644 index 0000000..8e9561e --- /dev/null +++ b/project/config/cfghost.sh @@ -0,0 +1,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 + x86_64-*-linux | x86_64-*-linux-* | x86_64-linux-* ) + mb_internal_cfghost=x86_64-linux ;; + + x86_64-*-midipix | x86_64-*-midipix-* | x86_64-midipix-* ) + mb_internal_cfghost=x86_64-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 +} -- cgit v1.2.3