Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* NAT_FILE set incorrectly in gdb/Makefile
@ 2009-04-19 19:00 Eli Zaretskii
  2009-04-19 21:35 ` Andreas Schwab
  0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2009-04-19 19:00 UTC (permalink / raw)
  To: gdb-patches

"make TAGS" curses thusly:

  Making TAGS
  .././gdb/config/i386/config/i386/nm-linux64.h: No such file or directory

This is on GNU/Linux, obviously, but I see the equivalent error
message in the DJGPP build.

The problem is this line from gdb/Makefile:

  NAT_FILE= config/i386/config/i386/nm-linux64.h

which is obviously incorrect.  It looks like the culprit is this line
from configure.ac:

  sed -e '/^NAT_FILE[     ]*=/s,^NAT_FILE[        ]*=[    ]*,&config/'"${gdb_host_cpu}"'/,' <Makefile >Makefile.tmp

which seems to run twice, perhaps once by configure, the other time by
config.status.  But that's a guess; the truth is I have no idea why
config/i386 gets prepended twice.  Does anyone see the villain?


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: NAT_FILE set incorrectly in gdb/Makefile
  2009-04-19 19:00 NAT_FILE set incorrectly in gdb/Makefile Eli Zaretskii
@ 2009-04-19 21:35 ` Andreas Schwab
  2009-04-20 17:09   ` Tom Tromey
  2009-04-20 18:58   ` Eli Zaretskii
  0 siblings, 2 replies; 6+ messages in thread
From: Andreas Schwab @ 2009-04-19 21:35 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: gdb-patches

Eli Zaretskii <eliz@gnu.org> writes:

> The problem is this line from gdb/Makefile:
>
>   NAT_FILE= config/i386/config/i386/nm-linux64.h
>
> which is obviously incorrect.  It looks like the culprit is this line
> from configure.ac:
>
>   sed -e '/^NAT_FILE[     ]*=/s,^NAT_FILE[        ]*=[    ]*,&config/'"${gdb_host_cpu}"'/,' <Makefile >Makefile.tmp
>
> which seems to run twice, perhaps once by configure, the other time by
> config.status.  But that's a guess; the truth is I have no idea why
> config/i386 gets prepended twice.  Does anyone see the villain?

Does this help?  Most likey config.status was run twice with different
values of CONFIG_FILES.

Andreas.

2009-04-19  Andreas Schwab  <schwab@linux-m68k.org>

	* configure.ac: Only postprocess Makefile when it has just been
	generated; avoid changequote.

Index: gdb/configure.ac
===================================================================
RCS file: /cvs/src/src/gdb/configure.ac,v
retrieving revision 1.93
diff -u -a -p -r1.93 gdb/configure.ac
--- gdb/configure.ac	17 Apr 2009 17:44:04 -0000	1.93
+++ gdb/configure.ac	19 Apr 2009 21:30:07 -0000
@@ -1967,10 +1967,11 @@ dnl Autoconf doesn't provide a mechanism
 dnl provided by makefile fragments.
 dnl
 
-changequote(,)dnl
-sed -e '/^NAT_FILE[ 	]*=/s,^NAT_FILE[ 	]*=[ 	]*,&config/'"${gdb_host_cpu}"'/,' <Makefile >Makefile.tmp
+case " $CONFIG_FILES " in
+*" Makefile "*)
+sed -e '/^NAT_FILE[[ 	]]*=/s,^NAT_FILE[[ 	]]*=[[ 	]]*,&config/'"${gdb_host_cpu}"'/,' <Makefile >Makefile.tmp
 mv -f Makefile.tmp Makefile
-changequote([,])dnl
+esac
 
 
 case x$CONFIG_HEADERS in

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: NAT_FILE set incorrectly in gdb/Makefile
  2009-04-19 21:35 ` Andreas Schwab
@ 2009-04-20 17:09   ` Tom Tromey
  2009-04-20 21:29     ` Andreas Schwab
  2009-04-20 18:58   ` Eli Zaretskii
  1 sibling, 1 reply; 6+ messages in thread
From: Tom Tromey @ 2009-04-20 17:09 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: Eli Zaretskii, gdb-patches

>>>>> "Andreas" == Andreas Schwab <schwab@linux-m68k.org> writes:

Andreas> 2009-04-19  Andreas Schwab  <schwab@linux-m68k.org>
Andreas> 	* configure.ac: Only postprocess Makefile when it has just been
Andreas> 	generated; avoid changequote.

This all seems like overkill to get a single variable that is only
used (AFAICT) in the TAGS rule.  Couldn't we just compute the real
value in the Makefile somehow, rather than a rewrite?

But, given how minor this is, if you'd rather move forward this way,
then this patch is ok if it works.

Tom


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: NAT_FILE set incorrectly in gdb/Makefile
  2009-04-19 21:35 ` Andreas Schwab
  2009-04-20 17:09   ` Tom Tromey
@ 2009-04-20 18:58   ` Eli Zaretskii
  1 sibling, 0 replies; 6+ messages in thread
From: Eli Zaretskii @ 2009-04-20 18:58 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: gdb-patches

> From: Andreas Schwab <schwab@linux-m68k.org>
> Cc: gdb-patches@sourceware.org
> Date: Sun, 19 Apr 2009 23:35:05 +0200
> 
> Does this help?  Most likey config.status was run twice with different
> values of CONFIG_FILES.

I believe you are right: it's run once for Makefile, and then again
for .gdbinit:

  for ac_config_target in $ac_config_targets
  do
    case "$ac_config_target" in
    # Handling of arguments.
    "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;;
    ".gdbinit" ) CONFIG_FILES="$CONFIG_FILES .gdbinit:gdbinit.in" ;;
    "gnulib/Makefile" ) CONFIG_FILES="$CONFIG_FILES gnulib/Makefile" ;;
    "$ac_config_links_1" ) CONFIG_LINKS="$CONFIG_LINKS $ac_config_links_1" ;;
    "depdir" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depdir" ;;
    "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
    "default" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;;
    "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h:config.in" ;;
    *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
  echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
     { (exit 1); exit 1; }; };;
    esac
  done

Yes, your patch solves the problem.  (I don't have Autoconf 2.59, so I
patched configure manually, rather than patching configure.ac and
regenerating configure.)

Thanks.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: NAT_FILE set incorrectly in gdb/Makefile
  2009-04-20 17:09   ` Tom Tromey
@ 2009-04-20 21:29     ` Andreas Schwab
  2009-04-21 18:25       ` Tom Tromey
  0 siblings, 1 reply; 6+ messages in thread
From: Andreas Schwab @ 2009-04-20 21:29 UTC (permalink / raw)
  To: tromey; +Cc: Eli Zaretskii, gdb-patches

Tom Tromey <tromey@redhat.com> writes:

> This all seems like overkill to get a single variable that is only
> used (AFAICT) in the TAGS rule.  Couldn't we just compute the real
> value in the Makefile somehow, rather than a rewrite?

It doesn't work anyway, because NM_FILE can also already include the
prefix (eg config/nm-linux.mh).  Here is an alternative patch, tested on
powerpc-linux.  I've also removed the substitution of nm_h which is not
used any more since the dependencies are autogenerated.

Andreas.

2009-04-20  Andreas Schwab  <schwab@linux-m68k.org>

	* configure.ac: Don't postprocess Makefile in config.status.
	Substitute GDB_NM_FILE.  Don't substitute nm_h.
	* Makefile.in (GDB_NM_FILE): Substitute.
	(TAGS): Use $(GDB_NM_FILE) instead of $(NAT_FILE).
	* configure: Regenerate.
	* gnulib/Makefile.in: Regenerate.

--- gdb/Makefile.in.~1.1078.~	2009-04-19 23:27:33.000000000 +0200
+++ gdb/Makefile.in	2009-04-20 22:48:16.000000000 +0200
@@ -1107,9 +1107,10 @@ gdb1$(EXEEXT): gdb$(EXEEXT)
 # TAGS depends on all the files that go into it so you can rebuild TAGS
 # with `make TAGS' and not have to say `rm TAGS' first.
 
+GDB_NM_FILE = @GDB_NM_FILE@
 TAGS: $(DEPFILES) $(TAGFILES_NO_SRCDIR) $(TAGFILES_WITH_SRCDIR)
 	@echo Making TAGS
-	@etags $(srcdir)/$(NAT_FILE) \
+	@etags $(srcdir)/$(GDB_NM_FILE) \
 	`(for i in $(DEPFILES) $(TAGFILES_NO_SRCDIR); do \
 		echo $(srcdir)/$$i ; \
 	done ; for i in $(TAGFILES_WITH_SRCDIR); do \
Index: gdb/configure.ac
===================================================================
RCS file: /cvs/src/src/gdb/configure.ac,v
retrieving revision 1.93
diff -u -a -p -r1.93 gdb/configure.ac
--- gdb/configure.ac	17 Apr 2009 17:44:04 -0000	1.93
+++ gdb/configure.ac	20 Apr 2009 21:20:00 -0000
@@ -1932,9 +1932,7 @@ files=
 links=
 
 rm -f nm.h
-nm_h=""
 if test "${nativefile}" != ""; then
-    nm_h=nm.h
     case "${nativefile}" in
       nm-*.h ) GDB_NM_FILE="config/${gdb_host_cpu}/${nativefile}" ;;
       * ) GDB_NM_FILE="${nativefile}"
@@ -1943,7 +1941,7 @@ if test "${nativefile}" != ""; then
     links="${links} nm.h"
     AC_DEFINE_UNQUOTED(GDB_NM_FILE, "${GDB_NM_FILE}", [nativefile])
 fi
-AC_SUBST(nm_h)
+AC_SUBST(GDB_NM_FILE)
 
 AC_LINK_FILES($files, $links)
 
@@ -1963,24 +1961,10 @@ AC_SUBST(pdfdir)
 
 AC_OUTPUT(Makefile .gdbinit:gdbinit.in gnulib/Makefile,
 [
-dnl Autoconf doesn't provide a mechanism for modifying definitions 
-dnl provided by makefile fragments.
-dnl
-
-changequote(,)dnl
-sed -e '/^NAT_FILE[ 	]*=/s,^NAT_FILE[ 	]*=[ 	]*,&config/'"${gdb_host_cpu}"'/,' <Makefile >Makefile.tmp
-mv -f Makefile.tmp Makefile
-changequote([,])dnl
-
-
 case x$CONFIG_HEADERS in
 xconfig.h:config.in)
 echo > stamp-h ;;
 esac
-],
-[
-gdb_host_cpu=$gdb_host_cpu
-nativefile=$nativefile
 ])
 
 exit 0

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: NAT_FILE set incorrectly in gdb/Makefile
  2009-04-20 21:29     ` Andreas Schwab
@ 2009-04-21 18:25       ` Tom Tromey
  0 siblings, 0 replies; 6+ messages in thread
From: Tom Tromey @ 2009-04-21 18:25 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: Eli Zaretskii, gdb-patches

>>>>> "Andreas" == Andreas Schwab <schwab@linux-m68k.org> writes:

Andreas> Here is an alternative patch, tested on powerpc-linux.  I've
Andreas> also removed the substitution of nm_h which is not used any
Andreas> more since the dependencies are autogenerated.

Much nicer.  This is ok, thank you.

Tom


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-04-21 18:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-19 19:00 NAT_FILE set incorrectly in gdb/Makefile Eli Zaretskii
2009-04-19 21:35 ` Andreas Schwab
2009-04-20 17:09   ` Tom Tromey
2009-04-20 21:29     ` Andreas Schwab
2009-04-21 18:25       ` Tom Tromey
2009-04-20 18:58   ` Eli Zaretskii

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox