-
Notifications
You must be signed in to change notification settings - Fork 3
/
depend.sh
executable file
·57 lines (50 loc) · 943 Bytes
/
depend.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash
if [ -z "$1" ]; then
echo "Usage: $0 <output_path>"
exit 1
fi
out=`readlink -f $1`
if [ ! -d $out ]; then
echo "Error: output path $out does not exist"
exit 2
fi
cd userspace
make dep || exit 1
tmp1=`mktemp`
tmp2=`mktemp`
while read line; do
first=1
for token in $line; do
if [ $first = 1 ]; then
first=0
continue
fi
echo $token >> $tmp1
done
done < lisa.dep
cat $tmp1 | sort | uniq > $tmp2
rm -f $tmp1
while read token; do
dir=`dirname $token`
if [ "$dir" = "." ]; then
continue
fi
dir=`cd $dir 2>/dev/null && pwd`
if [ -z "$dir" ]; then
continue
fi
token=$dir/`basename $token`
target=`echo -n $token | sed 's|.*/\(include/linux/.*\)$|linux-2.6/\1|'`
if [ "$token" = "$target" ]; then
continue;
fi
target=$out/$target
dstdir=`dirname $target`
if [ ! -d $dstdir ]; then
echo mkdir -p $dstdir
mkdir -p $dstdir
fi
echo cp $token $target
cp $token $target
done < $tmp2
rm -f $tmp2