Intel 386 Mach host port
[deliverable/binutils-gdb.git] / gdb / munch
CommitLineData
dd3b648e
RP
1#!/bin/sh
2
3# create an initialization procedure from a list of .o files
4
5echo '/* Do not modify this file. It is created automatically by "munch". */'
6echo 'void initialize_all_files () {'
7
faaaea3c
SG
8NMOPT=""
9case $1 in
44f0c5db
JG
10MUNCH_NM=*)
11 MUNCH_NM=`echo $1 | sed 's/MUNCH_NM=//'`; shift ;;
12-*)
13 NMOPT=$1; shift ;;
faaaea3c
SG
14esac
15
dd3b648e 16# make it easy to use a different nm, e.g. for cross-developing
faaaea3c 17
44f0c5db 18MUNCH_NM="${MUNCH_NM-nm} $NMOPT"
dd3b648e
RP
19if test "`$MUNCH_NM main.o | egrep 'T _?main$'`" = "" ; then
20 # System V style nm
21 shift;
22 $MUNCH_NM $* | egrep '^(.*[^a-zA-Z_]_|_)_?initialize_.*\.text' | \
23 sed -e 's/^.*\(_initialize_[a-zA-Z0-9_]*\)[^a-zA-Z0-9_].*$/ {extern void \1 (); \1 ();}/'
24else
25 # BSD style nm
44f0c5db
JG
26 # We now accept either text or data symbols, since the RT/PC uses data.
27 $MUNCH_NM -p $* | egrep '[TD] *_?_initialize_' | \
28 sed -e 's/^.*[TD] *_*\(.*\)/ {extern void _\1 (); _\1 ();}/'
dd3b648e
RP
29fi
30
31echo '}'
This page took 0.036394 seconds and 4 git commands to generate.