5 MPERS_AWK="${0%/*}/mpers.awk"
10 CFLAGS="$CFLAGS -gdwarf-4 -c"
12 CPPFLAGS="$CPPFLAGS -MM -MG"
14 VAR_NAME='mpers_target_var'
15 BITS_DIR="mpers${ARCH_FLAG}"
19 's/^#[[:space:]]*include[[:space:]]\+DEF_MPERS_TYPE(\([^)[:space:]]*\))$/\1/p' \
22 f_h="${BITS_DIR}/${m_type}.h"
23 f_c="${BITS_DIR}/${m_type}.c"
24 f_i="${BITS_DIR}/${m_type}.i"
25 f_o="${BITS_DIR}/${m_type}.o"
26 f_d1="${BITS_DIR}/${m_type}.d1"
27 f_d2="${BITS_DIR}/${m_type}.d2"
29 /DEF_MPERS_TYPE('"${m_type}"')$/n
31 /^[[:space:]]*#[[:space:]]*include[[:space:]]\+\"xlat\//d
32 /^#[[:space:]]*include[[:space:]]\+MPERS_DEFS$/ {s//'"${m_type} ${VAR_NAME}"';/;q}
33 ' "${PARSER_FILE}" > "${f_c}"
34 $CPP $CPPFLAGS "${f_c}" > "${f_i}"
35 grep -F -q "${m_type}.h" "${f_i}" ||
37 sed -i -e '/DEF_MPERS_TYPE/d' "${f_c}"
38 $CC $CFLAGS $ARCH_FLAG "${f_c}" -o "${f_o}"
39 readelf --debug-dump=info "${f_o}" > "${f_d1}"
41 /^[[:space:]]*<1>/,/^[[:space:]]*<1><[^>]\+>: Abbrev Number: 0/!d
42 /^[[:space:]]*<[^>]\+><[^>]\+>: Abbrev Number: 0/d
43 s/^[[:space:]]*<[[:xdigit:]]\+>[[:space:]]\+//
44 s/^[[:space:]]*\(\(<[[:xdigit:]]\+>\)\{2\}\):[[:space:]]\+/\1\n/
46 p' "${f_d1}" > "${f_d2}"
47 gawk -v VAR_NAME="$VAR_NAME" -v ARCH_FLAG="${ARCH_FLAG#-}" \
48 -f "$MPERS_AWK" "${f_d2}" > "${f_h}"