Release 941017
[wine/gsoc-2012-control.git] / tools / make_debug
blob09a63f90c0ea4687ef8eadd281c9eea7e4a788d9
1 #!/bin/sh
3 # This script scans the whole source code for symbols of the form dprintf_xxx,
4 # generates the necessary macro definitions and puts them into the files
5 # include/stddebug.h and include/debug.h . This script must be started with
6 # cwd = rootdir of the Wine-distribution.
8 # Michael Patra <micky@marie.physik.tu-berlin.de>
10 makedepend -s"# /* Do not remove this line or change anything below this line */" -finclude/debug.h
11 echo " " >> include/debug.h
12 grep -h dprintf_ */*.c | tr -d '[:blank:]' | cut -d"(" -f1 | sort | uniq | \
13 cut -d"_" -f2 > temp.$$
14 echo " " >> include/debug.h
15 echo "#ifdef DEBUG_NONE_EXT" >> include/debug.h
16 cat temp.$$ |
18 while read x
20 y=`echo $x | tr a-z A-Z`
21 echo "#undef DEBUG_$y" >> include/debug.h
22 done
24 echo "#endif" >> include/debug.h
25 echo " " >> include/debug.h
26 echo " " >> include/debug.h
27 echo "#ifdef DEBUG_ALL_EXT" >> include/debug.h
28 cat temp.$$ |
30 while read x
32 y=`echo $x | tr a-z A-Z`
33 echo "#define DEBUG_$y" >> include/debug.h
34 done
36 echo "#endif" >> include/debug.h
37 echo " " >> include/debug.h
38 echo " " >> include/debug.h
39 echo "#ifdef DEBUG_RUNTIME" >> include/debug.h
40 echo "#ifdef DEBUG_DEFINE_VARIABLES" >> include/debug.h
41 echo "short debug_msg_enabled[]={" >> include/debug.h
42 i=0;
43 cat temp.$$ |
45 while read x
47 y=`echo $x | tr a-z A-Z`
48 echo "#ifdef DEBUG_$y" >> include/debug.h
49 echo "1," >> include/debug.h
50 echo "#else" >> include/debug.h
51 echo "0," >> include/debug.h
52 echo "#endif" >> include/debug.h
53 done
55 echo "0};" >> include/debug.h
56 echo "#else" >> include/debug.h
57 echo "extern short debug_msg_enabled[];" >> include/debug.h
58 echo "#endif" >> include/debug.h
59 echo "#endif" >> include/debug.h
60 echo " " >> include/debug.h
61 echo " " >> include/debug.h
62 i=0
63 cat temp.$$ |
65 while read x
67 y=`echo $x | tr a-z A-Z`
68 echo "#ifdef DEBUG_RUNTIME" >> include/debug.h
69 echo "#define dprintf_$x if(debug_msg_enabled[$i]) fprintf" >> include/debug.h
70 echo "#else" >> include/debug.h
71 echo "#ifdef DEBUG_$y" >> include/debug.h
72 echo "#define dprintf_$x fprintf" >> include/debug.h
73 echo "#else" >> include/debug.h
74 echo "#define dprintf_$x" >> include/debug.h
75 echo "#endif" >> include/debug.h
76 echo "#endif" >> include/debug.h
77 echo " " >> include/debug.h
78 let i=$i+1
79 done
81 makedepend -s"# /* Do not remove this line or change anything below this line */" -finclude/stddebug.h
82 echo " " >> include/stddebug.h
83 echo "#ifdef DEBUG_NONE" >> include/stddebug.h
84 cat temp.$$ |
86 while read x
88 y=`echo $x | tr a-z A-Z`
89 echo "#undef DEBUG_$y" >> include/stddebug.h
90 done
92 echo "#endif" >> include/stddebug.h
93 echo " " >> include/stddebug.h
94 echo " " >> include/stddebug.h
95 echo "#ifdef DEBUG_ALL" >> include/stddebug.h
96 cat temp.$$ |
98 while read x
100 y=`echo $x | tr a-z A-Z`
101 echo "#define DEBUG_$y" >> include/stddebug.h
102 done
104 echo "#endif" >> include/stddebug.h
105 echo " " >> include/debug.h
106 echo " " >> include/debug.h
107 echo "#ifdef DEBUG_RUNTIME" >> include/debug.h
108 echo "#ifdef DEBUG_DEFINE_VARIABLES" >> include/debug.h
109 echo "static char *debug_msg_name[] = {" >> include/debug.h
110 cat temp.$$ |
112 while read x
114 echo "\"$x\"," >> include/debug.h
115 done
117 echo "\"\"};" >> include/debug.h
118 echo "#endif" >> include/debug.h
119 echo "#endif" >> include/debug.h
120 rm temp.$$