blob: a45f38c650a3543b0b16c85011e8b6eaab4cd840 [file] [log] [blame]
Patrick Williams92b42cb2022-09-03 06:53:57 -05001#!/bin/bash
2#
3# Copyright OpenEmbedded Contributors
4#
5# SPDX-License-Identifier: MIT
6#
7# Wrap llvm-config since the native llvm-config will remap some values correctly
8# if placed in the target sysroot but for flags, it would provide the native ones.
9# Provide ours from the environment instead.
10
11NEXT_LLVM_CONFIG="$(which -a llvm-config | sed -n 2p)"
12if [[ $# == 0 ]]; then
13 exec "$NEXT_LLVM_CONFIG"
14fi
15
16remain=""
17output=""
18for arg in "$@"; do
19 case "$arg" in
20 --cppflags)
21 output="${output} ${CPPFLAGS}"
22 ;;
23 --cflags)
24 output="${output} ${CFLAGS}"
25 ;;
26 --cxxflags)
27 output="${output} ${CXXFLAGS}"
28 ;;
29 --ldflags)
30 output="${output} ${LDFLAGS}"
31 ;;
32 *)
33 remain="${remain} ${arg}"
34 ;;
35 esac
36done
37
38if [ "${remain}" != "" ]; then
39 output="${output} "$("$NEXT_LLVM_CONFIG" ${remain})
40fi
41
42echo "${output}"