1#!/bin/bash
2
3file=$1
4project=$(echo "$2" | cut -d = -f 2)
5
6if [[ "$file" = "" ]] ; then
7    echo "Usage:  $0 <file with smatch messages> -p=<project>"
8    exit 1
9fi
10
11if [[ "$project" != "kernel" ]] ; then
12    exit 0
13fi
14
15bin_dir=$(dirname $0)
16remove=$(echo ${bin_dir}/../smatch_data/kernel.implicit_dependencies.remove)
17tmp=$(mktemp /tmp/smatch.XXXX)
18
19# echo "// list of syscalls and the fields they write/read to." > kernel.implicit_dependencies
20# echo '// generated by `gen_implicit_dependencies.sh`' >> kernel.implicit_dependencies
21grep -w read_list $file >> $tmp
22grep -w write_list $file >> $tmp
23# cat $tmp $remove $remove 2> /dev/null | sort | uniq -u >> kernel.implicit_dependencies
24cat $tmp >> kernel.implicit_dependencies
25rm $tmp
26echo "Done.  List saved as 'kernel.implicit_dependencies"
27