Print this page
11972 resync smatch
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/tools/smatch/src/smatch_scripts/build_generic_data.sh
+++ new/usr/src/tools/smatch/src/smatch_scripts/build_generic_data.sh
1 1 #!/bin/bash
2 2
3 3 # This is a generic script to parse --info output. For the kernel, don't use
4 4 # this script, use build_kernel_data.sh instead.
5 5
6 6 NR_CPU=$(cat /proc/cpuinfo | grep ^processor | wc -l)
7 7 SCRIPT_DIR=$(dirname $0)
8 8 DATA_DIR=smatch_data
9 9 PROJECT=smatch_generic
10 10 TARGET=""
11 11
12 12 function usage {
13 13 echo
14 14 echo "Usage: $0"
15 15 echo "Updates the smatch_data/ directory and builds the smatch database"
16 16 echo " -p <project> (default = $PROJECT)"
17 17 echo
18 18 exit 1
19 19 }
20 20
21 21 while true ; do
22 22 if [[ "$1" == "--target" ]] ; then
23 23 shift
24 24 TARGET="$1"
25 25 shift
26 26 elif [ "$1" == "-p" ] || [ "$1" == "--project" ] ; then
27 27 shift
28 28 PROJECT="$1"
29 29 shift
30 30 elif [ "$1" == "--help" ] || [ "$1" = "-h" ] ; then
31 31 usage
32 32 else
33 33 break
34 34 fi
35 35 done
36 36
37 37 if [ -e $SCRIPT_DIR/../smatch ] ; then
38 38 BIN_DIR=$SCRIPT_DIR/../
39 39 else
40 40 echo "This script should be located in the smatch_scripts/ subdirectory of the smatch source."
41 41 exit 1
42 42 fi
43 43
44 44 # If someone is building the database for the first time then make sure all the
↓ open down ↓ |
44 lines elided |
↑ open up ↑ |
45 45 # required packages are installed
46 46 if [ ! -e smatch_db.sqlite ] ; then
47 47 [ -e smatch_warns.txt ] || touch smatch_warns.txt
48 48 if ! $SCRIPT_DIR/../smatch_data/db/create_db.sh -p=$PROJECT smatch_warns.txt ; then
49 49 echo "Hm... Not working. Make sure you have all the sqlite3 packages"
50 50 echo "And the sqlite3 libraries for Perl and Python"
51 51 exit 1
52 52 fi
53 53 fi
54 54
55 -make -j${NR_CPU} CHECK="$BIN_DIR/smatch --call-tree --info --param-mapper --spammy --file-output" $TARGET
55 +if [[ ! -z $ARCH ]]; then
56 + KERNEL_ARCH="ARCH=$ARCH"
57 +fi
58 +if [[ ! -z $CROSS_COMPILE ]] ; then
59 + KERNEL_CROSS_COMPILE="CROSS_COMPILE=$CROSS_COMPILE"
60 +fi
56 61
62 +make $KERNEL_ARCH $KERNEL_CROSS_COMPILE -j${NR_CPU} CHECK="$BIN_DIR/smatch --call-tree --info --param-mapper --spammy --file-output" $TARGET
63 +
57 64 find -name \*.c.smatch -exec cat \{\} \; -exec rm \{\} \; > smatch_warns.txt
58 65
59 66 for i in $SCRIPT_DIR/gen_* ; do
60 67 $i smatch_warns.txt -p=${PROJECT}
61 68 done
62 69
63 70 mkdir -p $DATA_DIR
64 71 mv $PROJECT.* $DATA_DIR
65 72
66 73 $SCRIPT_DIR/../smatch_data/db/create_db.sh -p=$PROJECT smatch_warns.txt
67 74
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX