avr-firmwares/finddeps.sh

12 lines
286 B
Bash
Raw Permalink Normal View History

2018-01-29 01:48:12 +01:00
#!/bin/sh
search() {
echo "$1"
prefix="$(printf "%s\n" "$1"|sed 's|[^/]*$||')"
deps="$(grep -E '^#include "[^"]*"$' "$1"|cut '-d"' -f2|
2018-01-30 21:42:45 +01:00
\sed "s|^|$prefix|;s|\.h\$|.c|"|grep -v "^$1")"
2018-01-29 01:48:12 +01:00
for i in $deps; do search $i; done
}
2018-01-30 21:42:45 +01:00
search "$1"|sort -u|grep -v "^$1"|sed 's|\.c$|.o|'