(sim_info): Print out statistics on instructions.
(sim_{trace,create_inferior}): Eliminate extraneous output unless
debugging.
+ (sim_open): If args == -t and DEBUG was defined, set d10v_debug.
+ Only initialize the hash table the first time sim_open is called.
* Makefile.in: Make objects depend on d10v_sim.h.
- ({,SIM_}CFLAGS): Include configure dependent switches.
+ ({,SIM_}CFLAGS): Include configure dependent switches. Setting
+ CFLAGS does not override host/target defines or SIM_CFLAGS.
+ (CC_FOR_BUILD,gencode): Use CC_FOR_BUILD to compile gencode.
+ (run): By default, the math library is not needed to be linked
+ in.
+ ({BFD,OPCODES,LIBIBERTY}_LIB): Define as variables so they can be
+ overridden.
* configure.in (--enable-sim-cflags): New switch to allow user to
set the defaults.
+ (CC_FOR_BUILD): Deal with canadian crosses.
* configure: Regenerate.
Wed Sep 04 04:45:34 1996 Mark Alexander <marka@cygnus.com>
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+default: all
+
VPATH = @srcdir@:@srcdir@/../common:@srcdir@/../../gdb/
srcdir = @srcdir@
srcroot = $(srcdir)/../..
AR = @AR@
AR_FLAGS = rc
CC = @CC@
+CC_FOR_BUILD = @CC_FOR_BUILD@
+CFLAGS = @CFLAGS@
SIM_CFLAGS = @sim_cflags@
-CFLAGS = @CFLAGS@ @DEFS@ $(SIM_CFLAGS)
+CONFIG_CFLAGS = @DEFS@ $(SIM_CFLAGS) $(HDEFINES) $(TDEFINES) $(CSEARCH) $(CSWITCHES) -DINSIDE_SIMULATOR
+BUILD_CFLAGS = -g -O $(CSEARCH)
MAKEINFO = makeinfo
RANLIB = @RANLIB@
-CC_FOR_BUILD = @CC_FOR_BUILD@
HDEFINES = @HDEFINES@
TDEFINES =
MAKEOVERRIDES=
#X=xstuff.o
-#XL=-lX11
+#X_LIB=-lX11
X=
-XL=
+X_LIB=
+MATH_LIB=
+
INCLUDE = d10v_sim.h
INCDIR = $(srcdir)/../../include
-I../../bfd -I$(INCDIR) -I$(srcdir)/../../bfd -I$(srcdir)/../../gdb -I$(srcdir)/../../newlib/libc/sys/d10v
DEP = mkdep
-all: run libsim.a
+LIBIBERTY_LIB = ../../libiberty/libiberty.a
+BFD_LIB = ../../bfd/libbfd.a
+OPCODES_LIB = ../../opcodes/libopcodes.a
+
+all: run libsim.a
-run: interp.o $(X) run.o table.o callback.o simops.o
- $(CC) $(CFLAGS) -o run $(X) interp.o table.o callback.o simops.o run.o ../../bfd/libbfd.a ../../libiberty/libiberty.a $(XL) -lm
+run: interp.o $(X) run.o table.o callback.o simops.o
+ $(CC) $(CFLAGS) $(CONFIG_CFLAGS) -o run $(X) interp.o table.o callback.o simops.o run.o $(BFD_LIB) $(LIBIBERTY_LIB) $(X_LIB) $(MATH_LIB)
interp.o:interp.c table.c $(INCLUDE)
run.o:run.c $(INCLUDE)
$(AR) $(ARFLAGS) libsim.a interp.o table.o simops.o
$(RANLIB) libsim.a
-simops.h: gencode
+simops.h: gencode
./gencode -h >$@
-table.c: gencode simops.h
+table.c: gencode simops.h
./gencode >$@
-gencode: gencode.c ../../opcodes/libopcodes.a $(INCLUDE)
- $(CC) $(CFLAGS) $(HDEFINES) $(TDEFINES) $(CSEARCH) $(CSWITCHE) -o gencode $(srcdir)/gencode.c ../../opcodes/libopcodes.a -lc
+gencode: gencode.c ../../opcodes/libopcodes.a $(INCLUDE)
+ $(CC_FOR_BUILD) $(BUILD_CFLAGS) -o gencode $(srcdir)/gencode.c $(OPCODES_LIB)
.c.o:
- $(CC) -c -DINSIDE_SIMULATOR $(CFLAGS) $(HDEFINES) $(TDEFINES) $(CSEARCH) $(CSWITCHES) $<
+ $(CC) -c $(CFLAGS) $(CONFIG_CFLAGS) $<
check:
fi
+# Put a plausible default for CC_FOR_BUILD in Makefile.
+# If we cannot run a trivial program, we must be cross compiling.
+echo $ac_n "checking whether cross-compiling""... $ac_c" 1>&6
+if eval "test \"`echo '$''{'ac_cv_c_cross'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test "$cross_compiling" = yes; then
+ ac_cv_c_cross=yes
+else
+cat > conftest.$ac_ext <<EOF
+#line 946 "configure"
+#include "confdefs.h"
+main(){return(0);}
+EOF
+{ (eval echo configure:950: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }
+if test -s conftest && (./conftest; exit) 2>/dev/null; then
+ ac_cv_c_cross=no
+else
+ ac_cv_c_cross=yes
+fi
+fi
+rm -fr conftest*
+fi
+
+echo "$ac_t""$ac_cv_c_cross" 1>&6
+cross_compiling=$ac_cv_c_cross
+
+if test "x$cross_compiling" = "xno"; then
+ CC_FOR_BUILD='$(CC)'
+else
+ CC_FOR_BUILD=gcc
+fi
+
. ${srcdir}/../../bfd/configure.host
# Check whether --enable-sim-cflags or --disable-sim-cflags was given.
+
AR=${AR-ar}
# Extract the first word of "ranlib", so it can be a program name with args.
ac_cv_c_cross=yes
else
cat > conftest.$ac_ext <<EOF
-#line 998 "configure"
+#line 1032 "configure"
#include "confdefs.h"
main(){return(0);}
EOF
-{ (eval echo configure:1002: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }
+{ (eval echo configure:1036: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }
if test -s conftest && (./conftest; exit) 2>/dev/null; then
ac_cv_c_cross=no
else
s%@CC@%$CC%g
s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
s%@INSTALL_DATA@%$INSTALL_DATA%g
+s%@CC_FOR_BUILD@%$CC_FOR_BUILD%g
s%@HDEFINES@%$HDEFINES%g
s%@AR@%$AR%g
s%@RANLIB@%$RANLIB%g
s%@sim_cflags@%$sim_cflags%g
-s%@CC_FOR_BUILD@%$CC_FOR_BUILD%g
CEOF
EOF
AC_PROG_INSTALL
AC_C_BIGENDIAN
+# Put a plausible default for CC_FOR_BUILD in Makefile.
+AC_C_CROSS
+if test "x$cross_compiling" = "xno"; then
+ CC_FOR_BUILD='$(CC)'
+else
+ CC_FOR_BUILD=gcc
+fi
+
. ${srcdir}/../../bfd/configure.host
AC_ARG_ENABLE(sim-cflags,
echo "Setting sim cflags = $sim_cflags" 6>&1
fi],[sim_cflags=""])dnl
+AC_SUBST(CC_FOR_BUILD)
AC_SUBST(CFLAGS)
AC_SUBST(HDEFINES)
AR=${AR-ar}
{
struct simops *s;
struct hash_entry *h, *prev;
+ static int init_p = 0;
+
if (args != NULL)
- (*d10v_callback->printf_filtered) (d10v_callback, "sim_open %s\n",args);
+ {
+#ifdef DEBUG
+ if (strcmp (args, "-t") == 0)
+ d10v_debug = DEBUG;
+ else
+#endif
+ (*d10v_callback->printf_filtered) (d10v_callback, "ERROR: unsupported option(s): %s\n",args);
+ }
/* put all the opcodes in the hash table */
- for (s = Simops; s->func; s++)
+ if (!init_p++)
{
- h = &hash_table[hash(s->opcode,s->format)];
-
- /* go to the last entry in the chain */
- while (h->next)
- h = h->next;
-
- if (h->ops)
+ for (s = Simops; s->func; s++)
{
- h->next = calloc(1,sizeof(struct hash_entry));
- h = h->next;
+ h = &hash_table[hash(s->opcode,s->format)];
+
+ /* go to the last entry in the chain */
+ while (h->next)
+ h = h->next;
+
+ if (h->ops)
+ {
+ h->next = calloc(1,sizeof(struct hash_entry));
+ h = h->next;
+ }
+ h->ops = s;
+ h->mask = s->mask;
+ h->opcode = s->opcode;
}
- h->ops = s;
- h->mask = s->mask;
- h->opcode = s->opcode;
}
}