blob: a45f38c650a3543b0b16c85011e8b6eaab4cd840 [file] [log] [blame]
#!/bin/bash
#
# Copyright OpenEmbedded Contributors
#
# SPDX-License-Identifier: MIT
#
# Wrap llvm-config since the native llvm-config will remap some values correctly
# if placed in the target sysroot but for flags, it would provide the native ones.
# Provide ours from the environment instead.
NEXT_LLVM_CONFIG="$(which -a llvm-config | sed -n 2p)"
if [[ $# == 0 ]]; then
exec "$NEXT_LLVM_CONFIG"
fi
remain=""
output=""
for arg in "$@"; do
case "$arg" in
--cppflags)
output="${output} ${CPPFLAGS}"
;;
--cflags)
output="${output} ${CFLAGS}"
;;
--cxxflags)
output="${output} ${CXXFLAGS}"
;;
--ldflags)
output="${output} ${LDFLAGS}"
;;
*)
remain="${remain} ${arg}"
;;
esac
done
if [ "${remain}" != "" ]; then
output="${output} "$("$NEXT_LLVM_CONFIG" ${remain})
fi
echo "${output}"