gen_ksymdeps.sh 610 B

12345678910111213141516171819202122232425262728293031
  1. #!/bin/sh
  2. # SPDX-License-Identifier: GPL-2.0
  3. set -e
  4. # List of exported symbols
  5. #
  6. # If the object has no symbol, $NM warns 'no symbols'.
  7. # Suppress the stderr.
  8. # TODO:
  9. # Use -q instead of 2>/dev/null when we upgrade the minimum version of
  10. # binutils to 2.37, llvm to 13.0.0.
  11. ksyms=$($NM $1 2>/dev/null | sed -n 's/.*__ksym_marker_\(.*\)/\1/p' | tr A-Z a-z)
  12. if [ -z "$ksyms" ]; then
  13. exit 0
  14. fi
  15. echo
  16. echo "ksymdeps_$1 := \\"
  17. for s in $ksyms
  18. do
  19. echo $s | sed -e 's:^_*: $(wildcard include/ksym/:' \
  20. -e 's:__*:/:g' -e 's/$/.h) \\/'
  21. done
  22. echo
  23. echo "$1: \$(ksymdeps_$1)"
  24. echo
  25. echo "\$(ksymdeps_$1):"