#!/bin/bash # # This script generates the required files for supporting the debug # channels used throught the code. # The generated files are # include/debugdefs.h # include/debug.h # The script must be run in the root directory of the project. # # Dimitrie O. Paun <dimi@cs.toronto.edu> # DEBUG_H="include/debug.h" DEBUG_DEFS_H="include/debugdefs.h" DEBUG_CHANNELS="$( tools/find_debug_channels )" DEBUG_CLASSES="fixme err warn trace" { cat <<EOF /* Do not modify this file -- it is automatically generated! */ #ifndef __WINE_DEBUGTOOLS_H #include "debugtools.h" #endif EOF echo "/* Definitions for channels identifiers */" chno=0 for ch in $DEBUG_CHANNELS do echo "#define dbch_${ch} $chno" let chno=$chno+1 done echo "/* Definitions for classes identifiers */" clno=0 for cl in $DEBUG_CLASSES do echo "#define dbcl_${cl} $clno" let clno=$clno+1 done } > $DEBUG_H # Now, on the last step, we proceed to construct # the definitions to be used by the main function. # These will be stored in include/debugdefs.h { cat <<EOF /* Do not modify this file -- it is automatically generated! */ #ifndef __WINE_DEBUGTOOLS_H #include "debugtools.h" #endif #define DEBUG_CHANNEL_COUNT $chno #ifdef DEBUG_RUNTIME short debug_msg_enabled[][DEBUG_CLASS_COUNT] = { EOF for ch in $DEBUG_CHANNELS do echo "{1, 1, 0, 0}," done echo '};' echo 'const char* debug_ch_name[] = {' for ch in $DEBUG_CHANNELS do echo "\"${ch}\"," done echo '};' echo 'const char* debug_cl_name[] = {' for ch in $DEBUG_CLASSES do echo "\"${ch}\"," done echo '};' cat <<EOF #endif /*DEBUG_RUNTIME*/ /* end of automatically generated debug.h */ EOF } > $DEBUG_DEFS_H