Removed the CN_xxx macros since they are not used, do not correspond to
[wine/multimedia.git] / tools / make_debug
blob2c1d5c6bf88cba0d3c73b7049abed3ce31e6418b
1 #!/bin/bash
3 # This script generates the required files for supporting the debug
4 # channels used throught the code.
5 # The generated files are
6 # include/debugdefs.h
7 # include/debug.h
8 # The script must be run in the root directory of the project.
10 # Dimitrie O. Paun <dimi@cs.toronto.edu>
12 DEBUG_H="include/debug.h"
13 DEBUG_DEFS_H="include/debugdefs.h"
15 DEBUG_CHANNELS="$( tools/find_debug_channels )"
16 DEBUG_CLASSES="fixme err warn trace"
19 cat <<EOF
20 /* Do not modify this file -- it is automatically generated! */
22 #ifndef __WINE_DEBUGTOOLS_H
23 #include "debugtools.h"
24 #endif
26 EOF
27 echo "/* Definitions for channels identifiers */"
29 chno=0
30 for ch in $DEBUG_CHANNELS
32 echo "#define dbch_${ch} $chno"
33 let chno=$chno+1
34 done
36 echo "/* Definitions for classes identifiers */"
37 clno=0
38 for cl in $DEBUG_CLASSES
40 echo "#define dbcl_${cl} $clno"
41 let clno=$clno+1
42 done
43 } > $DEBUG_H
45 # Now, on the last step, we proceed to construct
46 # the definitions to be used by the main function.
47 # These will be stored in include/debugdefs.h
49 cat <<EOF
50 /* Do not modify this file -- it is automatically generated! */
52 #ifndef __WINE_DEBUGTOOLS_H
53 #include "debugtools.h"
54 #endif
56 #define DEBUG_CHANNEL_COUNT $chno
57 #ifdef DEBUG_RUNTIME
58 short debug_msg_enabled[][DEBUG_CLASS_COUNT] = {
59 EOF
61 for ch in $DEBUG_CHANNELS
63 echo "{1, 1, 0, 0},"
64 done
65 echo '};'
67 echo 'const char* debug_ch_name[] = {'
68 for ch in $DEBUG_CHANNELS
70 echo "\"${ch}\","
71 done
72 echo '};'
74 echo 'const char* debug_cl_name[] = {'
75 for ch in $DEBUG_CLASSES
77 echo "\"${ch}\","
78 done
79 echo '};'
81 cat <<EOF
83 #endif /*DEBUG_RUNTIME*/
85 /* end of automatically generated debug.h */
86 EOF
88 } > $DEBUG_DEFS_H