summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/llvm/llvm/llvm-config
blob: 5e4ded2da5bc95d429c6f717a2f25223bbbe210e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/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}"
      ;;
    --shared-mode)
      output="${output} shared"
      ;;
    --libs)
      output="${output} -lLLVM"
      ;;
    --link-shared)
      break
      ;;
    *)
      remain="${remain} ${arg}"
      ;;
  esac
done

if [ "${remain}" != "" ]; then
      output="${output} "$("$NEXT_LLVM_CONFIG" ${remain})
fi

echo "${output}"