12 lines
286 B
Bash
Executable File
12 lines
286 B
Bash
Executable File
#!/bin/sh
|
|
|
|
search() {
|
|
echo "$1"
|
|
prefix="$(printf "%s\n" "$1"|sed 's|[^/]*$||')"
|
|
deps="$(grep -E '^#include "[^"]*"$' "$1"|cut '-d"' -f2|
|
|
\sed "s|^|$prefix|;s|\.h\$|.c|"|grep -v "^$1")"
|
|
for i in $deps; do search $i; done
|
|
}
|
|
|
|
search "$1"|sort -u|grep -v "^$1"|sed 's|\.c$|.o|'
|