[3/4] gdbserver: Make `make TAGS' actually work

Message ID alpine.LFD.2.21.2001231457290.14118@redsun52.ssa.fujisawa.hgst.com
State Committed
Headers

Commit Message

Maciej W. Rozycki Jan. 23, 2020, 7:41 p.m. UTC
  Fix a:

make: *** No rule to make target '.../gdb/gdbserver/arch/arm.c', needed by 'TAGS'.  Stop.

error produced by `make TAGS' by making the list of sources processed 
match actual file locations and by moving host-specific object files 
listed in DEPFILES to nat/ or target/ subdirectories as appropriate so 
that the location of the corresponding source file can be mechanically 
determined.

	gdb/gdbserver/
	* Makefile.in (SFILES): Adjust paths to point to real files.
	(OBS): Move waitstatus.o to target/waitstatus.o.
	(TAGS): Transform paths appropriately.
	(%.o): Rename to...
	(nat/%.o): ... this pattern rule.
	(%.o): Rename to...
	(target/%.o): ... this pattern rule.
	* configure.srv: Adjust paths throughout to include nat/ prefix 
	with the revant files.
	* configure.ac: Add `nat' and `target' to CONFIG_SRC_SUBDIR.
	* configure: Regenerate.
---
Hi,

 NB SFILES is only maintained for the purpose of `make TAGS', so I could 
not persuade myself to put deliberate breakage there.  I find it amazing 
and amusing nobody has noticed that for many years and just been blindly 
putting gibberish there.

  Maciej
---
 gdb/gdbserver/Makefile.in   |   36 +++++++++++++++++---------------
 gdb/gdbserver/configure     |    2 -
 gdb/gdbserver/configure.ac  |    2 -
 gdb/gdbserver/configure.srv |   49 ++++++++++++++++++++++++++------------------
 4 files changed, 51 insertions(+), 38 deletions(-)

gdb-gdbserver-sfiles-paths.diff
  

Comments

Tom Tromey Jan. 23, 2020, 9:31 p.m. UTC | #1
>>>>> "Maciej" == Maciej W Rozycki <macro@wdc.com> writes:

Maciej> error produced by `make TAGS' by making the list of sources processed 
Maciej> match actual file locations and by moving host-specific object files 
Maciej> listed in DEPFILES to nat/ or target/ subdirectories as appropriate so 
Maciej> that the location of the corresponding source file can be mechanically 
Maciej> determined.

Maciej> 	gdb/gdbserver/
Maciej> 	* Makefile.in (SFILES): Adjust paths to point to real files.
Maciej> 	(OBS): Move waitstatus.o to target/waitstatus.o.
Maciej> 	(TAGS): Transform paths appropriately.
Maciej> 	(%.o): Rename to...
Maciej> 	(nat/%.o): ... this pattern rule.
Maciej> 	(%.o): Rename to...
Maciej> 	(target/%.o): ... this pattern rule.
Maciej> 	* configure.srv: Adjust paths throughout to include nat/ prefix 
Maciej> 	with the revant files.
Maciej> 	* configure.ac: Add `nat' and `target' to CONFIG_SRC_SUBDIR.
Maciej> 	* configure: Regenerate.

Thanks for the patch.

Maciej>  NB SFILES is only maintained for the purpose of `make TAGS', so I could 
Maciej> not persuade myself to put deliberate breakage there.  I find it amazing 
Maciej> and amusing nobody has noticed that for many years and just been blindly 
Maciej> putting gibberish there.

LOL.  Well, anything not tested will surely break :)

This looks ok to me.

Tom
  
Maciej W. Rozycki Jan. 24, 2020, 1:01 p.m. UTC | #2
On Thu, 23 Jan 2020, Tom Tromey wrote:

> Maciej>  NB SFILES is only maintained for the purpose of `make TAGS', so I could 
> Maciej> not persuade myself to put deliberate breakage there.  I find it amazing 
> Maciej> and amusing nobody has noticed that for many years and just been blindly 
> Maciej> putting gibberish there.
> 
> LOL.  Well, anything not tested will surely break :)
> 
> This looks ok to me.

 Applied now, thanks for your review.

  Maciej
  

Patch

Index: binutils-gdb/gdb/gdbserver/Makefile.in
===================================================================
--- binutils-gdb.orig/gdb/gdbserver/Makefile.in
+++ binutils-gdb/gdb/gdbserver/Makefile.in
@@ -198,11 +198,11 @@  SFILES = \
 	$(srcdir)/win32-low.c \
 	$(srcdir)/wincecompat.c \
 	$(srcdir)/x86-low.c \
-	$(srcdir)/arch/arm.c \
-	$(srcdir)/arch/arm-get-next-pcs.c \
-	$(srcdir)/arch/arm-linux.c \
-	$(srcdir)/arch/ppc-linux-common.c \
 	$(srcdir)/../alloc.c \
+	$(srcdir)/../arch/arm.c \
+	$(srcdir)/../arch/arm-get-next-pcs.c \
+	$(srcdir)/../arch/arm-linux.c \
+	$(srcdir)/../arch/ppc-linux-common.c \
 	$(srcdir)/../../gdbsupport/btrace-common.c \
 	$(srcdir)/../../gdbsupport/buffer.c \
 	$(srcdir)/../../gdbsupport/cleanups.c \
@@ -229,15 +229,15 @@  SFILES = \
 	$(srcdir)/../../gdbsupport/safe-strerror.c \
 	$(srcdir)/../../gdbsupport/tdesc.c \
 	$(srcdir)/../../gdbsupport/xml-utils.c \
-	$(srcdir)/nat/aarch64-sve-linux-ptrace.c \
-	$(srcdir)/nat/linux-btrace.c \
-	$(srcdir)/nat/linux-namespaces.c \
-	$(srcdir)/nat/linux-osdata.c \
-	$(srcdir)/nat/linux-personality.c \
-	$(srcdir)/nat/mips-linux-watch.c \
-	$(srcdir)/nat/ppc-linux.c \
-	$(srcdir)/nat/fork-inferior.c \
-	$(srcdir)/target/waitstatus.c
+	$(srcdir)/../nat/aarch64-sve-linux-ptrace.c \
+	$(srcdir)/../nat/linux-btrace.c \
+	$(srcdir)/../nat/linux-namespaces.c \
+	$(srcdir)/../nat/linux-osdata.c \
+	$(srcdir)/../nat/linux-personality.c \
+	$(srcdir)/../nat/mips-linux-watch.c \
+	$(srcdir)/../nat/ppc-linux.c \
+	$(srcdir)/../nat/fork-inferior.c \
+	$(srcdir)/../target/waitstatus.c
 
 DEPFILES = @GDBSERVER_DEPFILES@
 
@@ -295,7 +295,7 @@  OBS = \
 	tracepoint.o \
 	utils.o \
 	version.o \
-	waitstatus.o \
+	target/waitstatus.o \
 	$(DEPFILES) \
 	$(LIBOBJS) \
 	$(XML_BUILTIN)
@@ -459,7 +459,9 @@  TAGS:	${TAGFILES}
 	etags \
 	  `for i in yzzy ${DEPFILES}; do \
 	     if [ x$$i != xyzzy ]; then \
-	       echo ${srcdir}/$$i | sed -e 's/\.o$$/\.c/' ; \
+	       echo ${srcdir}/$$i | sed -e 's/\.o$$/\.c/' \
+		 -e 's,/\(arch\|nat\|target\)/,/../\1/,' \
+		 -e 's,/\(gdbsupport\)/,/../../\1/,'; \
 	     fi; \
 	   done` \
 	  ${TAGFILES}
@@ -633,11 +635,11 @@  gdbsupport/%.o: ../../gdbsupport/%.c
 	$(COMPILE) $<
 	$(POSTCOMPILE)
 
-%.o: ../nat/%.c
+nat/%.o: ../nat/%.c
 	$(COMPILE) $<
 	$(POSTCOMPILE)
 
-%.o: ../target/%.c
+target/%.o: ../target/%.c
 	$(COMPILE) $<
 	$(POSTCOMPILE)
 
Index: binutils-gdb/gdb/gdbserver/configure
===================================================================
--- binutils-gdb.orig/gdb/gdbserver/configure
+++ binutils-gdb/gdb/gdbserver/configure
@@ -6025,7 +6025,7 @@  ac_config_commands="$ac_config_commands
 
 
 # Create sub-directories for objects and dependencies.
-CONFIG_SRC_SUBDIR="arch gdbsupport"
+CONFIG_SRC_SUBDIR="arch gdbsupport nat target"
 
 
 ac_config_commands="$ac_config_commands gdbdepdir"
Index: binutils-gdb/gdb/gdbserver/configure.ac
===================================================================
--- binutils-gdb.orig/gdb/gdbserver/configure.ac
+++ binutils-gdb/gdb/gdbserver/configure.ac
@@ -56,7 +56,7 @@  ACX_NONCANONICAL_HOST
 ZW_CREATE_DEPDIR
 
 # Create sub-directories for objects and dependencies.
-CONFIG_SRC_SUBDIR="arch gdbsupport"
+CONFIG_SRC_SUBDIR="arch gdbsupport nat target"
 AC_SUBST(CONFIG_SRC_SUBDIR)
 
 AC_CONFIG_COMMANDS([gdbdepdir],[
Index: binutils-gdb/gdb/gdbserver/configure.srv
===================================================================
--- binutils-gdb.orig/gdb/gdbserver/configure.srv
+++ binutils-gdb/gdb/gdbserver/configure.srv
@@ -28,21 +28,22 @@  ipa_ppc_linux_regobj="powerpc-32l-ipa.o
 
 # Linux object files.  This is so we don't have to repeat
 # these files over and over again.
-srv_linux_obj="linux-low.o linux-osdata.o linux-procfs.o linux-ptrace.o linux-waitpid.o linux-personality.o linux-namespaces.o fork-child.o fork-inferior.o"
+srv_linux_obj="linux-low.o nat/linux-osdata.o nat/linux-procfs.o nat/linux-ptrace.o nat/linux-waitpid.o nat/linux-personality.o nat/linux-namespaces.o fork-child.o nat/fork-inferior.o"
 
 # Input is taken from the "${target}" variable.
 
 case "${target}" in
-  aarch64*-*-linux*)	srv_tgtobj="linux-aarch64-low.o aarch64-linux-hw-point.o"
+  aarch64*-*-linux*)	srv_tgtobj="linux-aarch64-low.o"
+			srv_tgtobj="$srv_tgtobj nat/aarch64-linux-hw-point.o"
 			srv_tgtobj="$srv_tgtobj linux-aarch32-low.o"
 			srv_tgtobj="$srv_tgtobj linux-aarch32-tdesc.o"
 			srv_tgtobj="${srv_tgtobj} arch/aarch32.o"
 			srv_tgtobj="${srv_tgtobj} arch/arm.o"
-			srv_tgtobj="$srv_tgtobj aarch64-linux.o"
+			srv_tgtobj="$srv_tgtobj nat/aarch64-linux.o"
 			srv_tgtobj="$srv_tgtobj arch/aarch64-insn.o"
 			srv_tgtobj="$srv_tgtobj arch/aarch64.o"
 			srv_tgtobj="$srv_tgtobj linux-aarch64-tdesc.o"
-			srv_tgtobj="$srv_tgtobj aarch64-sve-linux-ptrace.o"
+			srv_tgtobj="$srv_tgtobj nat/aarch64-sve-linux-ptrace.o"
 			srv_tgtobj="${srv_tgtobj} $srv_linux_obj"
 			srv_linux_regsets=yes
 			srv_linux_thread_db=yes
@@ -86,14 +87,18 @@  case "${target}" in
 			srv_linux_thread_db=yes
 			;;
   i[34567]86-*-cygwin*)	srv_regobj=""
-			srv_tgtobj="x86-low.o x86-dregs.o win32-low.o win32-i386-low.o"
+			srv_tgtobj="x86-low.o nat/x86-dregs.o win32-low.o"
+			srv_tgtobj="${srv_tgtobj} win32-i386-low.o"
 			srv_tgtobj="${srv_tgtobj} arch/i386.o"
 			;;
   i[34567]86-*-linux*)	srv_tgtobj="${srv_tgtobj} arch/i386.o"
-			srv_tgtobj="${srv_tgtobj} $srv_linux_obj linux-x86-low.o x86-low.o x86-dregs.o i387-fp.o"
+			srv_tgtobj="${srv_tgtobj} $srv_linux_obj"
+			srv_tgtobj="${srv_tgtobj} linux-x86-low.o x86-low.o"
+			srv_tgtobj="${srv_tgtobj} nat/x86-dregs.o i387-fp.o"
 			srv_tgtobj="${srv_tgtobj} linux-x86-tdesc.o"
-			srv_tgtobj="${srv_tgtobj} linux-btrace.o x86-linux.o"
-			srv_tgtobj="${srv_tgtobj} x86-linux-dregs.o"
+			srv_tgtobj="${srv_tgtobj} nat/linux-btrace.o"
+			srv_tgtobj="${srv_tgtobj} nat/x86-linux.o"
+			srv_tgtobj="${srv_tgtobj} nat/x86-linux-dregs.o"
 			srv_linux_usrregs=yes
 			srv_linux_regsets=yes
 			srv_linux_thread_db=yes
@@ -102,13 +107,15 @@  case "${target}" in
 			ipa_obj="${ipa_obj} arch/i386-ipa.o"
 			;;
   i[34567]86-*-lynxos*)	srv_regobj=""
-			srv_tgtobj="lynx-low.o lynx-i386-low.o fork-child.o fork-inferior.o"
+			srv_tgtobj="lynx-low.o lynx-i386-low.o fork-child.o"
+			srv_tgtobj="${srv_tgtobj} nat/fork-inferior.o"
 			srv_tgtobj="${srv_tgtobj} arch/i386.o"
 			srv_lynxos=yes
 			;;
   i[34567]86-*-mingw32ce*)
 			srv_regobj=""
-			srv_tgtobj="x86-low.o x86-dregs.o win32-low.o win32-i386-low.o"
+			srv_tgtobj="x86-low.o nat/x86-dregs.o win32-low.o"
+			srv_tgtobj="${srv_tgtobj} win32-i386-low.o"
 			srv_tgtobj="${srv_tgtobj} arch/i386.o"
 			srv_tgtobj="${srv_tgtobj} wincecompat.o"
 			# hostio_last_error implementation is in win32-low.c
@@ -117,7 +124,7 @@  case "${target}" in
 			srv_mingwce=yes
 			;;
   i[34567]86-*-mingw*)	srv_regobj=""
-			srv_tgtobj="x86-low.o x86-dregs.o win32-low.o win32-i386-low.o"
+			srv_tgtobj="x86-low.o nat/x86-dregs.o win32-low.o"				srv_tgtobj="${srv_tgtobj} win32-i386-low.o"
 			srv_tgtobj="${srv_tgtobj} arch/i386.o"
 			srv_mingw=yes
 			;;
@@ -159,7 +166,7 @@  case "${target}" in
 			srv_regobj="${srv_regobj} mips64-linux.o"
 			srv_regobj="${srv_regobj} mips64-dsp-linux.o"
 			srv_tgtobj="$srv_linux_obj linux-mips-low.o"
-			srv_tgtobj="${srv_tgtobj} mips-linux-watch.o"
+			srv_tgtobj="${srv_tgtobj} nat/mips-linux-watch.o"
 			srv_xmlfiles="mips-linux.xml"
 			srv_xmlfiles="${srv_xmlfiles} mips-dsp-linux.xml"
 			srv_xmlfiles="${srv_xmlfiles} mips-cpu.xml"
@@ -203,7 +210,8 @@  case "${target}" in
 			srv_regobj="${srv_regobj} powerpc-isa205-ppr-dscr-vsx64l.o"
 			srv_regobj="${srv_regobj} powerpc-isa207-vsx64l.o"
 			srv_regobj="${srv_regobj} powerpc-isa207-htm-vsx64l.o"
-			srv_tgtobj="$srv_linux_obj linux-ppc-low.o ppc-linux.o"
+			srv_tgtobj="$srv_linux_obj linux-ppc-low.o"
+			srv_tgtobj="$srv_linux_obj nat/ppc-linux.o"
 			srv_tgtobj="${srv_tgtobj} arch/ppc-linux-common.o"
 			srv_xmlfiles="rs6000/powerpc-32l.xml"
 			srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-altivec32l.xml"
@@ -350,12 +358,13 @@  case "${target}" in
 			srv_linux_thread_db=yes
 			;;
   x86_64-*-linux*)	srv_tgtobj="$srv_linux_obj linux-x86-low.o x86-low.o"
-			srv_tgtobj="${srv_tgtobj} x86-dregs.o i387-fp.o"
+			srv_tgtobj="${srv_tgtobj} nat/x86-dregs.o i387-fp.o"
 			srv_tgtobj="${srv_tgtobj} arch/i386.o arch/amd64.o"
 			srv_tgtobj="${srv_tgtobj} linux-x86-tdesc.o"
-			srv_tgtobj="${srv_tgtobj} linux-btrace.o x86-linux.o"
-			srv_tgtobj="${srv_tgtobj} x86-linux-dregs.o"
-			srv_tgtobj="${srv_tgtobj} amd64-linux-siginfo.o"
+			srv_tgtobj="${srv_tgtobj} nat/linux-btrace.o"
+			srv_tgtobj="${srv_tgtobj} nat/x86-linux.o"
+			srv_tgtobj="${srv_tgtobj} nat/x86-linux-dregs.o"
+			srv_tgtobj="${srv_tgtobj} nat/amd64-linux-siginfo.o"
 			srv_linux_usrregs=yes # This is for i386 progs.
 			srv_linux_regsets=yes
 			srv_linux_thread_db=yes
@@ -364,12 +373,14 @@  case "${target}" in
 			ipa_obj="${ipa_obj} arch/amd64-ipa.o"
 			;;
   x86_64-*-mingw*)	srv_regobj=""
-			srv_tgtobj="x86-low.o x86-dregs.o i387-fp.o win32-low.o win32-i386-low.o"
+			srv_tgtobj="x86-low.o nat/x86-dregs.o i387-fp.o"
+			srv_tgtobj="${srv_tgtobj} win32-low.o win32-i386-low.o"
 			srv_tgtobj="${srv_tgtobj} arch/amd64.o"
 			srv_mingw=yes
 			;;
   x86_64-*-cygwin*)	srv_regobj=""
-			srv_tgtobj="x86-low.o x86-dregs.o i387-fp.o win32-low.o win32-i386-low.o"
+			srv_tgtobj="x86-low.o nat/x86-dregs.o i387-fp.o"
+			srv_tgtobj="${srv_tgtobj} win32-low.o win32-i386-low.o"
 			srv_tgtobj="${srv_tgtobj} arch/amd64.o"
 			;;