Newer
Older
# This script generates the required file for supporting the debug
# The generated file is
# include/debugdefs.h
# The script must be run in the root directory of the project.
# 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! */
#define DEBUG_CLASS_COUNT __DBCL_COUNT
#ifdef DEBUG_RUNTIME
const char * const debug_cl_name[] = { "fixme", "err", "warn", "trace" };
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
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