Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame] | 1 | #!/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 | |
| 11 | NEXT_LLVM_CONFIG="$(which -a llvm-config | sed -n 2p)" |
| 12 | if [[ $# == 0 ]]; then |
| 13 | exec "$NEXT_LLVM_CONFIG" |
| 14 | fi |
| 15 | |
| 16 | remain="" |
| 17 | output="" |
| 18 | for 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 | ;; |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 32 | --shared-mode) |
| 33 | output="${output} shared" |
| 34 | ;; |
| 35 | --libs) |
| 36 | output="${output} -lLLVM" |
| 37 | ;; |
| 38 | --link-shared) |
| 39 | break |
| 40 | ;; |
Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame] | 41 | *) |
| 42 | remain="${remain} ${arg}" |
| 43 | ;; |
| 44 | esac |
| 45 | done |
| 46 | |
| 47 | if [ "${remain}" != "" ]; then |
| 48 | output="${output} "$("$NEXT_LLVM_CONFIG" ${remain}) |
| 49 | fi |
| 50 | |
| 51 | echo "${output}" |