summaryrefslogtreecommitdiffstats
path: root/external/meta-clang/recipes-devtools/clang/llvm-common/llvm-config
diff options
context:
space:
mode:
Diffstat (limited to 'external/meta-clang/recipes-devtools/clang/llvm-common/llvm-config')
-rw-r--r--external/meta-clang/recipes-devtools/clang/llvm-common/llvm-config39
1 files changed, 39 insertions, 0 deletions
diff --git a/external/meta-clang/recipes-devtools/clang/llvm-common/llvm-config b/external/meta-clang/recipes-devtools/clang/llvm-common/llvm-config
new file mode 100644
index 00000000..4462896a
--- /dev/null
+++ b/external/meta-clang/recipes-devtools/clang/llvm-common/llvm-config
@@ -0,0 +1,39 @@
+#!/bin/bash
+#
+# Wrapper script for llvm-config. Supplies the right environment variables
+# for the target and delegates to the native llvm-config for anything else. This
+# is needed because arguments like --ldflags, --cxxflags, etc. are set by the
+# native compile rather than the target compile.
+#
+
+SCRIPT_DIR="$(dirname "$(readlink -f "$0")")"
+NEXT_LLVM_CONFIG="$(which -a llvm-config | sed -n 2p)"
+export YOCTO_ALTERNATE_EXE_PATH="$(readlink -f "$SCRIPT_DIR/../llvm-config")"
+
+if [[ $# == 0 ]]; then
+ exec "$NEXT_LLVM_CONFIG"
+fi
+
+if [[ $1 == "--libs" ]]; then
+ exec "$NEXT_LLVM_CONFIG" $@
+fi
+
+for arg in "$@"; do
+ case "$arg" in
+ --cppflags)
+ echo $TARGET_CPPFLAGS
+ ;;
+ --cflags)
+ echo $TARGET_CFLAGS
+ ;;
+ --cxxflags)
+ echo $TARGET_CXXFLAGS
+ ;;
+ --ldflags)
+ echo $TARGET_LDFLAGS
+ ;;
+ *)
+ echo "$("$NEXT_LLVM_CONFIG" "$arg")"
+ ;;
+ esac
+done