4 # Generate a linker script for GNU ld.
20 info "usage: $0 [-p <pattern>] [-I <ignore-list>] -o <output> <inputs>"
30 PATTERN="^mrp_" # export everything prefixed with mrp_
31 IGNORE="MRP_PRINTF_LIKE" # ignore these symbols/macros
32 IT="," # ignore-list is comma-separated
33 SOURCES="" # no default input, must be specified
34 OUTPUT="" # no default output, must be specified
37 while [ -n "${1#-}" ]; do
40 if [ -z "$OUTPUT" ]; then
44 error "Multiple output files requested."
49 if [ -z "$PATTERN" ]; then
53 error "Multiple patterns given ($PATTERN, $1)."
66 error "Unknown option '$1'."
76 # check that we've got everything mandatory
77 if [ -z "$OUTPUT" ]; then
78 error "No output file specified (use the -o option)."
82 if [ -z "$SOURCES" ]; then
83 error "No input files specified."
87 if [ -z "$PATTERN" ]; then
88 error "Invalid (empty) pattern."
92 if [ -n "$IGNORE" ]; then
93 ignore_opts="-I $IGNORE"
99 info "Generating linker script $OUTPUT..."
105 ctags $ignore_opts -f - --c-kinds=p $SOURCES | \
106 awk "/$PATTERN/ { print \$1; }" | \