blob: 4462896af6e201f4a45df3a2f579ec506711efcc [file] [log] [blame]
rjw1f884582022-01-06 17:20:42 +08001#!/bin/bash
2#
3# Wrapper script for llvm-config. Supplies the right environment variables
4# for the target and delegates to the native llvm-config for anything else. This
5# is needed because arguments like --ldflags, --cxxflags, etc. are set by the
6# native compile rather than the target compile.
7#
8
9SCRIPT_DIR="$(dirname "$(readlink -f "$0")")"
10NEXT_LLVM_CONFIG="$(which -a llvm-config | sed -n 2p)"
11export YOCTO_ALTERNATE_EXE_PATH="$(readlink -f "$SCRIPT_DIR/../llvm-config")"
12
13if [[ $# == 0 ]]; then
14 exec "$NEXT_LLVM_CONFIG"
15fi
16
17if [[ $1 == "--libs" ]]; then
18 exec "$NEXT_LLVM_CONFIG" $@
19fi
20
21for arg in "$@"; do
22 case "$arg" in
23 --cppflags)
24 echo $TARGET_CPPFLAGS
25 ;;
26 --cflags)
27 echo $TARGET_CFLAGS
28 ;;
29 --cxxflags)
30 echo $TARGET_CXXFLAGS
31 ;;
32 --ldflags)
33 echo $TARGET_LDFLAGS
34 ;;
35 *)
36 echo "$("$NEXT_LLVM_CONFIG" "$arg")"
37 ;;
38 esac
39done