1#!/bin/sh -e
2
3list="$(sed -n '/^strace_SOURCES[[:space:]]*=/,/^[[:space:]]*# end of strace_SOURCES/ s/^[[:space:]]*\([[:alnum:]][^.]*\.c\)[[:space:]]*\\$/\1/p' Makefile.am |
4	xargs -r grep -lx '#[[:space:]]*include[[:space:]]\+MPERS_DEFS' |
5	tr '\n' ' ')"
6
7cat > mpers.am <<EOF
8# Generated by $0; do not edit.
9mpers_source_files = $list
10EOF
11
12sed -n 's/^#[[:space:]]*include[[:space:]]*"xlat\/\([^."]\+\)\.h".*/extern const struct xlat \1[];/p' \
13	$list > mpers_xlat.h
14