This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[rfc] Really tm.h, nm.h and xm.h optional


Hello,

Following on from the m68hc11 and tm.h configury changes, the attached:

	o	fixes a buglet in that
		configure.in didn't ignore tm.h
		even when it claimed that it was.

	o	Removes the hardwired dependencies
		in defs.h/Makefile.in on the files
		on tm.h, xm.h, nm.h.  The previous
		change didn't quite get it right :-(
		
	o	Add (optional) macros GDB_NM_FILE,
		GDB_XM_FILE and GDB_TM_FILE to
		config.h.

		This has the side effect of fixing
		the buglet where changing the
		configuration may not trigger a
		full rebuild.

tm.h isn't needed when the target is pure mult-arch.
nm.h isn't needed when the target isn't native.  (I suspect pure
multi-arch targets won't need it either.)
xm.h isn't needed when autoconf manages to handle all host dependencies.

I should note that there are N different ways of handling the optional
xm/nm/tm problem.  I happened to have chosen this one.  The optional
nm.h configury was previously handled by having an empty
config/nm-empty.h.  I could change things to mimic that behaviour (if
anyone has a strong opinion).

Comments? Suggestions?

	Andrew

PS, Stephane Carrez: You'll need to apply this patch or one like it to
your local tree for the m68hc11.
Thu Jul 27 17:38:35 2000  Andrew Cagney  <cagney@b1.cygnus.com>

	* configure.in (targetfile): Ignore TM_FILE, don't just issue
 	warning.
	(tm_h, xm_h, nm_h, GDB_TM_FILE, GDB_XM_FILE, GDB_NM_FILE): Define.
	* acconfig.h (GDB_XM_FILE, GDB_TM_FILE, GDB_NM_FILE): Add.
	* config/nm-empty.h: Delete.
	* defs.h (xm.h, nm.h, tm.h): Only include when GDB_XM_FILE,
 	GDB_NM_FILE or GDB_TM_FILE defined.
	* Makefile.in (defs_h): Replace tm.h, xm.h and nm.h with tm_h,
 	xm_h and nm_h macro that are defined by configure.
	(tm_h, xm_h, tm_h): New.
	* configure, config.in: Regenerate
	* TODO: Update.

Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.39
diff -p -r1.39 Makefile.in
*** Makefile.in	2000/07/10 06:16:51	1.39
--- Makefile.in	2000/07/27 08:24:29
*************** command_h =	command.h
*** 548,554 ****
  gdbcmd_h =	gdbcmd.h $(command_h)
  
  call_cmds_h =	call-cmds.h
! defs_h =	defs.h xm.h tm.h nm.h config.status config.h gdbarch.h ui-file.h
  
  top_h =		top.h
  inferior_h =	inferior.h $(breakpoint_h)
--- 548,557 ----
  gdbcmd_h =	gdbcmd.h $(command_h)
  
  call_cmds_h =	call-cmds.h
! xm_h =		@xm_h@
! tm_h =		@tm_h@
! nm_h =		@nm_h@
! defs_h =	defs.h $(xm_h) $(tm_h) $(nm_h) config.status config.h gdbarch.h ui-file.h
  
  top_h =		top.h
  inferior_h =	inferior.h $(breakpoint_h)
Index: TODO
===================================================================
RCS file: /cvs/src/src/gdb/TODO,v
retrieving revision 1.42
diff -p -r1.42 TODO
*** TODO	2000/07/24 14:49:05	1.42
--- TODO	2000/07/27 08:24:34
*************** fundamental architectural change.
*** 348,359 ****
  Add built-by, build-date, tm, xm, nm and anything else into gdb binary
  so that you can see how the GDB was created.
  
- Some of these (*m.h) would be added to the generated config.h.  That
- in turn would fix a long standing bug where by the build process many
- not notice a changed tm.h file.  Since everything depends on config.h,
- a change to *m.h forces a change to config.h and, consequently forces
- a rebuild.
- 
  --
  
  Add an "info bfd" command that displays supported object formats,
--- 348,353 ----
Index: acconfig.h
===================================================================
RCS file: /cvs/src/src/gdb/acconfig.h,v
retrieving revision 1.10
diff -p -r1.10 acconfig.h
*** acconfig.h	2000/07/27 04:01:24	1.10
--- acconfig.h	2000/07/27 08:24:36
***************
*** 125,127 ****
--- 125,135 ----
  /* Multi-arch enabled. */
  #undef GDB_MULTI_ARCH
  
+ /* hostfile */
+ #undef GDB_XM_FILE
+ 
+ /* targetfile */
+ #undef GDB_TM_FILE
+ 
+ /* nativefile */
+ #undef GDB_NM_FILE
Index: configure.in
===================================================================
RCS file: /cvs/src/src/gdb/configure.in,v
retrieving revision 1.40
diff -p -r1.40 configure.in
*** configure.in	2000/07/27 04:01:24	1.40
--- configure.in	2000/07/27 08:24:50
*************** case "${GDB_MULTI_ARCH}" in
*** 1042,1047 ****
--- 1042,1048 ----
      GDB_MULTI_ARCH_PURE )
  	if test x"${targetfile}" != x ; then
  	    AC_MSG_WARN("GDB: Ingoring TM_FILE in ${target_makefile_frag}")
+ 	    targetfile=""
  	fi ;;
      *)  AC_MSG_ERROR("GDB: Unknown GDB_MULTI_ARCH value ${GDB_MULTI_ARCH}");;
  esac
*************** fi
*** 1055,1086 ****
  AC_SUBST(SUBDIRS)
  
  # If hostfile (XM_FILE) and/or targetfile (TM_FILE) and/or nativefile
! # (NAT_FILE) is not set in config/*/*.m[ht] files, we don't make the
! # corresponding links.  But we have to remove the xm.h files and tm.h
! # files anyway, e.g. when switching from "configure host" to
! # "configure none".
  
  files=
  links=
  rm -f xm.h
  if test "${hostfile}" != ""; then
! files="${files} config/${gdb_host_cpu}/${hostfile}"
! links="${links} xm.h"
  fi
  rm -f tm.h
  if test "${targetfile}" != ""; then
! files="${files} config/${gdb_target_cpu}/${targetfile}"
! links="${links} tm.h"
  fi
  rm -f nm.h
  if test "${nativefile}" != ""; then
! files="${files} config/${gdb_host_cpu}/${nativefile}"
! links="${links} nm.h"
! else
! # A cross-only configuration.
! files="${files} config/nm-empty.h"
! links="${links} nm.h"
  fi
  AC_PROG_LN_S
  
  AC_LINK_FILES($files, $links)
--- 1056,1100 ----
  AC_SUBST(SUBDIRS)
  
  # If hostfile (XM_FILE) and/or targetfile (TM_FILE) and/or nativefile
! # (NAT_FILE) is not set in config/*/*.m[ht] files, we link to an empty
! # version.
  
  files=
  links=
+ 
  rm -f xm.h
+ xm_h=""
  if test "${hostfile}" != ""; then
!     xm_h=xm.h
!     GDB_XM_FILE="config/${gdb_host_cpu}/${hostfile}"
!     files="${files} ${GDB_XM_FILE}"
!     links="${links} xm.h"
!     AC_DEFINE_UNQUOTED(GDB_XM_FILE, ${GDB_XM_FILE})
  fi
+ AC_SUBST(xm_h)
+ 
  rm -f tm.h
+ tm_h=""
  if test "${targetfile}" != ""; then
!     tm_h=tm.h
!     GDB_TM_FILE="config/${gdb_target_cpu}/${targetfile}"
!     files="${files} ${GDB_TM_FILE}"
!     links="${links} tm.h"
!     AC_DEFINE_UNQUOTED(GDB_TM_FILE, ${GDB_TM_FILE})
  fi
+ AC_SUBST(tm_h)
+ 
  rm -f nm.h
+ nm_h=""
  if test "${nativefile}" != ""; then
!     nm_h=nm.h
!     GDB_NM_FILE="config/${gdb_host_cpu}/${nativefile}"
!     files="${files} ${GDB_NM_FILE}"
!     links="${links} nm.h"
!     AC_DEFINE_UNQUOTED(GDB_NM_FILE, ${GDB_NM_FILE})
  fi
+ AC_SUBST(nm_h)
+ 
  AC_PROG_LN_S
  
  AC_LINK_FILES($files, $links)
Index: defs.h
===================================================================
RCS file: /cvs/src/src/gdb/defs.h,v
retrieving revision 1.28
diff -p -r1.28 defs.h
*** defs.h	2000/07/27 04:01:24	1.28
--- defs.h	2000/07/27 08:24:54
***************
*** 79,85 ****
  #define GDB_MULTI_ARCH_TM 2
  
  /* The target is pure multi-arch.  The MULTI-ARCH vector provides all
!    definitions.  "tm.h" is NOT included. */
  
  #define GDB_MULTI_ARCH_PURE 3
  
--- 79,85 ----
  #define GDB_MULTI_ARCH_TM 2
  
  /* The target is pure multi-arch.  The MULTI-ARCH vector provides all
!    definitions.  "tm.h" is linked to an empty file. */
  
  #define GDB_MULTI_ARCH_PURE 3
  
*************** enum val_prettyprint
*** 710,738 ****
    };
  
  
! /* Host machine definition.  This will be a symlink to one of the
!    xm-*.h files, built by the `configure' script.  */
  
  #include "xm.h"
  
! /* Native machine support.  This will be a symlink to one of the
!    nm-*.h files, built by the `configure' script.  */
  
  #include "nm.h"
  
! /* Target machine definition.  This will be a symlink to one of the
     tm-*.h files, built by the `configure' script.  */
  
! #if (GDB_MULTI_ARCH < GDB_MULTI_ARCH_PURE)
  #include "tm.h"
  #endif
  
  /* GDB_MULTI_ARCH is normally set by configure.in using information
     from configure.tgt or the config/%/%.mt Makefile fragment.  Since
!    some targets have defined it in their tm.h file, don't provide a
!    default until after "tm.h" has been included.  (In the above #if,
!    GDB_MULTI_ARCH will be interpreted as zero if it is not
!    defined). */
  
  #ifndef GDB_MULTI_ARCH
  #define GDB_MULTI_ARCH 0
--- 710,744 ----
    };
  
  
! /* Optional host machine definition.  Pure autoconf targets will not
!    need a "xm.h" file.  This will be a symlink to one of the xm-*.h
!    files, built by the `configure' script.  */
  
+ #ifdef GDB_XM_FILE
  #include "xm.h"
+ #endif
  
! /* Optional native machine support.  Non-native (and possibly pure
!    multi-arch) targets do not need a "nm.h" file.  This will be a
!    symlink to one of the nm-*.h files, built by the `configure'
!    script.  */
  
+ #ifdef GDB_NM_FILE
  #include "nm.h"
+ #endif
  
! /* Optional target machine definition.  Pure multi-arch configurations
!    do not need a "tm.h" file.  This will be a symlink to one of the
     tm-*.h files, built by the `configure' script.  */
  
! #ifdef GDB_TM_FILE
  #include "tm.h"
  #endif
  
  /* GDB_MULTI_ARCH is normally set by configure.in using information
     from configure.tgt or the config/%/%.mt Makefile fragment.  Since
!    some targets have defined it in their "tm.h" file, delay providing
!    a default definition until after "tm.h" has been included.. */
  
  #ifndef GDB_MULTI_ARCH
  #define GDB_MULTI_ARCH 0
Index: config/nm-empty.h
===================================================================
RCS file: nm-empty.h
diff -N nm-empty.h
*** /sourceware/cvs-tmp/cvs2pxTar	Thu Jul 27 01:24:58 2000
--- /dev/null	Tue May  5 13:32:27 1998
***************
*** 1,2 ****
- /* This is just a dummy file to symlink to when GDB is configured as a
-    cross-only debugger.  */
--- 0 ----

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]