Masahiro Yamada | bbda5ec | 2018-11-30 10:05:26 +0900 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | # SPDX-License-Identifier: GPL-2.0 |
| 3 | |
| 4 | set -e |
| 5 | |
| 6 | # List of exported symbols |
Masahiro Yamada | 52d83df | 2021-08-19 09:01:14 +0900 | [diff] [blame] | 7 | # |
| 8 | # If the object has no symbol, $NM warns 'no symbols'. |
| 9 | # Suppress the stderr. |
| 10 | # TODO: |
| 11 | # Use -q instead of 2>/dev/null when we upgrade the minimum version of |
| 12 | # binutils to 2.37, llvm to 13.0.0. |
Masahiro Yamada | bc7cd2d | 2021-08-30 17:20:33 +0900 | [diff] [blame] | 13 | ksyms=$($NM $1 2>/dev/null | sed -n 's/.*__ksym_marker_\(.*\)/\1/p') |
Masahiro Yamada | bbda5ec | 2018-11-30 10:05:26 +0900 | [diff] [blame] | 14 | |
| 15 | if [ -z "$ksyms" ]; then |
| 16 | exit 0 |
| 17 | fi |
| 18 | |
| 19 | echo |
| 20 | echo "ksymdeps_$1 := \\" |
| 21 | |
| 22 | for s in $ksyms |
| 23 | do |
Masahiro Yamada | bc7cd2d | 2021-08-30 17:20:33 +0900 | [diff] [blame] | 24 | printf ' $(wildcard include/ksym/%s) \\\n' "$s" |
Masahiro Yamada | bbda5ec | 2018-11-30 10:05:26 +0900 | [diff] [blame] | 25 | done |
| 26 | |
| 27 | echo |
| 28 | echo "$1: \$(ksymdeps_$1)" |
| 29 | echo |
| 30 | echo "\$(ksymdeps_$1):" |