73 lines
1.3 KiB
Bash
Executable File
73 lines
1.3 KiB
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# This script generates the required file for supporting the debug
|
|
# channels used throught the code.
|
|
# The generated file is
|
|
# include/debugdefs.h
|
|
# The script must be run in the root directory of the project.
|
|
#
|
|
# Dimitrie O. Paun <dimi@cs.toronto.edu>
|
|
# Patrik Stridvall <ps@leissner.se>
|
|
#
|
|
|
|
DEBUG_CHANNELS=`tools/find_debug_channels`
|
|
|
|
exec > include/debugdefs.h
|
|
|
|
cat <<EOF
|
|
/* Do not modify this file -- it is automatically generated! */
|
|
|
|
#include "debugtools.h"
|
|
|
|
#define DEBUG_CLASS_COUNT __DBCL_COUNT
|
|
|
|
#ifdef DEBUG_RUNTIME
|
|
|
|
const char * const debug_cl_name[] = { "fixme", "err", "warn", "trace" };
|
|
|
|
EOF
|
|
|
|
chno=0
|
|
for ch in $DEBUG_CHANNELS
|
|
do
|
|
echo "int dbch_$ch = $chno;"
|
|
chno=`expr $chno + 1`
|
|
done
|
|
echo
|
|
echo "#define DEBUG_CHANNEL_COUNT $chno"
|
|
|
|
count=1
|
|
echo
|
|
echo 'char __debug_msg_enabled[DEBUG_CHANNEL_COUNT][DEBUG_CLASS_COUNT] = {'
|
|
for ch in $DEBUG_CHANNELS
|
|
do
|
|
if [ "${count}" != "${chno}" ]; then
|
|
echo "{1, 1, 0, 0},"
|
|
else
|
|
echo "{1, 1, 0, 0}"
|
|
fi
|
|
count=`expr $count + 1`
|
|
done
|
|
echo '};'
|
|
|
|
count=1
|
|
echo
|
|
echo 'const char * const debug_ch_name[DEBUG_CHANNEL_COUNT] = {'
|
|
for ch in $DEBUG_CHANNELS
|
|
do
|
|
if [ "${count}" != "${chno}" ]; then
|
|
echo "\"${ch}\",";
|
|
else
|
|
echo "\"${ch}\"";
|
|
fi
|
|
count=`expr $count + 1`
|
|
done
|
|
echo '};'
|
|
|
|
cat <<EOF
|
|
|
|
#endif /*DEBUG_RUNTIME*/
|
|
|
|
/* end of automatically generated debug.h */
|
|
EOF
|