diff options
-rw-r--r-- | sim/Makefile.in | 85 | ||||
-rw-r--r-- | sim/README-HACKING | 126 |
2 files changed, 198 insertions, 13 deletions
diff --git a/sim/Makefile.in b/sim/Makefile.in index 4bb1243defd..6c2d2cf4153 100644 --- a/sim/Makefile.in +++ b/sim/Makefile.in @@ -1,5 +1,5 @@ # Makefile template for Configure for the sim library. -# Copyright (C) 1993, 1995 Free Software Foundation, Inc. +# Copyright (C) 1993, 1995, 1997 Free Software Foundation, Inc. # Written by Cygnus Support. # # This file is part of BFD, the Binary File Descriptor library. @@ -77,6 +77,11 @@ CC_FOR_BUILD = $(CC) # @target_makefile_frag@ ### +RUNTEST = `if [ -f $${srcdir}/../dejagnu/runtest ] ; then \ + echo $${srcdir}/../dejagnu/runtest ; else echo runtest; \ + fi` +RUNTESTFLAGS= + FLAGS_TO_PASS = \ "prefix=$(prefix)" \ "exec_prefix=$(exec_prefix)" \ @@ -90,11 +95,37 @@ FLAGS_TO_PASS = \ "MAKEINFO=$(MAKEINFO)" \ "INSTALL=$(INSTALL)" \ "INSTALL_DATA=$(INSTALL_DATA)" \ - "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" + "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \ + "RUNTEST=$(RUNTEST)" \ + "RUNTESTFLAGS=$(RUNTESTFLAGS)" + +# The use of $$(x_FOR_TARGET) reduces the command line length by not +# duplicating the lengthy definition. +TARGET_FLAGS_TO_PASS = \ + "prefix=$(prefix)" \ + "exec_prefix=$(exec_prefix)" \ + "against=$(against)" \ + 'CC=$$(CC_FOR_TARGET)' \ + "CC_FOR_TARGET=$(CC_FOR_TARGET)" \ + "CFLAGS=$(CFLAGS)" \ + "CHILLFLAGS=$(CHILLFLAGS)" \ + 'CHILL=$$(CHILL_FOR_TARGET)' \ + "CHILL_FOR_TARGET=$(CHILL_FOR_TARGET)" \ + "CHILL_LIB=$(CHILL_LIB)" \ + 'CXX=$$(CXX_FOR_TARGET)' \ + "CXX_FOR_TARGET=$(CXX_FOR_TARGET)" \ + "CXXFLAGS=$(CXXFLAGS)" \ + "INSTALL=$(INSTALL)" \ + "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \ + "INSTALL_DATA=$(INSTALL_DATA)" \ + "MAKEINFO=$(MAKEINFO)" \ + "RUNTEST=$(RUNTEST)" \ + "RUNTESTFLAGS=$(RUNTESTFLAGS)" + all: @rootme=`pwd` ; export rootme ; \ - for dir in . ${SUBDIRS}; do \ + for dir in . `echo ${SUBDIRS} | sed 's/testsuite//'` ; do \ if [ "$$dir" = "." ]; then \ true; \ elif [ -d $$dir ]; then \ @@ -102,16 +133,6 @@ all: else true; fi; \ done -clean mostlyclean: - @rootme=`pwd` ; export rootme ; \ - for dir in . ${SUBDIRS}; do \ - if [ "$$dir" = "." ]; then \ - true; \ - elif [ -d $$dir ]; then \ - (cd $$dir; $(MAKE) $(FLAGS_TO_PASS) $@); \ - else true; fi; \ - done - distclean maintainer-clean realclean: @rootme=`pwd` ; export rootme ; \ for dir in . ${SUBDIRS}; do \ @@ -133,6 +154,23 @@ install: else true; fi; \ done +installcheck: + @echo No installcheck target is available yet for the GNU simulators. + +installcheck: + +# The check target can not use subdir_do, because subdir_do does not +# use TARGET_FLAGS_TO_PASS. +check: force + @if [ -f testsuite/Makefile ]; then \ + rootme=`pwd`; export rootme; \ + rootsrc=`cd $(srcdir); pwd`; export rootsrc; \ + cd testsuite; \ + $(MAKE) $(TARGET_FLAGS_TO_PASS) check; \ + else true; fi + + + info: install-info: dvi: @@ -170,3 +208,24 @@ autoconf-common: fi ; \ fi ; \ done + +autoconf-changelog: + user="`finger $$USER | sed -n 's/^.*Name: //p'` <$$USER@`hostname`>" ; \ + date="`date | sed 's/ [^ ]* \([0-9]*\)$$/ \1/'`" ; \ + echo "$$date $$user" ; \ + for d in * ; \ + do \ + if [ -d $$d -a -f $$d/configure.in ] ; \ + then \ + if grep SIM_AC_COMMON $$d/configure.in >/dev/null ; \ + then \ + echo "Creating new-ChangeLog in $$d ..." ; \ + ( echo "$$date $$user" ; \ + echo "" ; \ + echo " * configure: Regenerated to track ../common/aclocal.m4 changes." ; \ + echo "" ; \ + cat $$d/ChangeLog \ + ) > $$d/new-ChangeLog ; \ + fi ; \ + fi ; \ + done diff --git a/sim/README-HACKING b/sim/README-HACKING new file mode 100644 index 00000000000..93ccf3478f4 --- /dev/null +++ b/sim/README-HACKING @@ -0,0 +1,126 @@ +This is a loose collection of notes for people hacking on simulators. +If this document gets big enough it can be prettied it up then. + +Contents + +- The "common" directory +- Common Makefile Support +- Generating "configure" files + +The "common" directory +====================== + +The common directory contains: + +- common documentation files (e.g. run.1, and maybe in time .texi files) +- common source files (e.g. run.c) +- common Makefile fragment and configury (e.g. Make-common.in, aclocal.m4). + +In addition "common" contains portions of the system call support +(e.g. callback.c, nltvals.def). + +Even though no files are built in this directory, it is still configured +so support for regenerating nltvals.def is present. + +Common Makefile Support +======================= + +A common configuration framework is available for simulators that want +to use it. The common framework exists to remove a lot of duplication +in configure.in and Makefile.in, and it also provides a foundation for +enhancing the simulators uniformly (e.g. the more they share in common +the easier a feature added to one is added to all). + +The configure.in of a simulator using the common framework should look like: + +--- snip --- +dnl Process this file with autoconf to produce a configure script. +sinclude(../common/aclocal.m4) +AC_PREREQ(2.5)dnl +AC_INIT(Makefile.in) + +SIM_AC_COMMON + +... target specific additions ... + +SIM_AC_OUTPUT +--- snip --- + +SIM_AC_COMMON: + +- invokes the autoconf macros most often used by the simulators +- defines --enable/--with options usable by all simulators +- initializes sim_link_files/sim_link_links as the set of symbolic links + to set up + +SIM_AC_OUTPUT: + +- creates the symbolic links defined in sim_link_{files,links} +- creates config.h +- creates the Makefile + +The Makefile.in of a simulator using the common framework should look like: + +--- snip --- +# Makefile for blah ... +# Copyright blah ... + +## COMMON_PRE_CONFIG_FRAG + +# These variables are given default values in COMMON_PRE_CONFIG_FRAG. +# We override the ones we need to here. +# Not all of these need to be mentioned, only the necessary ones. + +# List of object files, less common parts. +SIM_OBJS = +# List of flags to always pass to $(CC). +SIM_EXTRA_CFLAGS = +# List of extra libraries to link with. +SIM_EXTRA_LIBS = +# List of extra program dependencies. +SIM_EXTRA_LIBDEPS = +# List of main object files for `run'. +SIM_RUN_OBJS = run.o +# Dependency of `all' to build any extra files. +SIM_EXTRA_ALL = +# Dependency of `install' to install any extra files. +SIM_EXTRA_INSTALL = +# Dependency of `clean' to clean any extra files. +SIM_EXTRA_CLEAN = + +## COMMON_POST_CONFIG_FRAG + +# Rules need to build $(SIM_OBJS), plus whatever else the target wants. + +... target specific rules ... +--- snip --- + +COMMON_{PRE,POST}_CONFIG_FRAG are markers for SIM_AC_OUTPUT to tell it +where to insert the two pieces of common/Make-common.in. +The resulting Makefile is created by doing autoconf substitions on +both the target's Makefile.in and Make-common.in, and inserting +the two pieces of Make-common.in into the target's Makefile.in at +COMMON_{PRE,POST}_CONFIG_FRAG. + +Generating "configure" files +============================ + +For target's using the common framework, "configure" can be generated +by running autoconf. This works because configure.in contains +"sinclude(../common/aclocal.m4)". + +To regenerate the configure files for all targets using the common framework: + + $ cd devo/sim + $ make -f Makefile.in autoconf-common + +To add a change-log entry to the ChangeLog file for each updated +directory (WARNING - check the modified new-ChangeLog files before +renaming): + + $ make -f Makefile.in autoconf-changelog + $ more */new-ChangeLog + $ for f in */new-ChangeLog ; do echo $f ; mv $f `dirname $f`/ChangeLog ; done + + + |