3 # Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 DRIVER_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
21 echo "Usage: $0 [BACKEND] ..."
22 echo "Available BACKEND drivers:"
24 for file in `find $DRIVER_PATH -name *-compile -type f`;
26 backend_driver=$(basename $file)
28 driver_length=$(expr ${#backend_driver} - ${sub_length})
29 backend=${backend_driver:0:${driver_length}} # 8 is length of "-compile"
33 if [ $backend_exist == 0 ]; then
34 echo " (There is no available backend drivers)"
38 # Get command from command-line
40 BACKEND_DRIVER="$BACKEND-compile"
42 if [[ -z "${BACKEND_DRIVER}" ]]; then
47 BACKEND_DRIVER_CMD="${DRIVER_PATH}/${BACKEND_DRIVER}"
49 if [[ ! -f "${BACKEND_DRIVER_CMD}" ]]; then
50 echo "ERROR: '${BACKEND_DRIVER}' is not supported"
55 "${BACKEND_DRIVER_CMD}" "$@"