gdb/Makefile.in: move ALLDEPFILES earlier in Makefile.in
authorAndrew Burgess <aburgess@redhat.com>
Wed, 23 Mar 2022 10:29:49 +0000 (10:29 +0000)
committerAndrew Burgess <aburgess@redhat.com>
Sun, 3 Apr 2022 14:45:54 +0000 (15:45 +0100)
If I do 'make tags' in the gdb build directory, the tags target does
complete, but I see these warnings:

  ../../src/gdb/arm.c: No such file or directory
  ../../src/gdb/arm-get-next-pcs.c: No such file or directory
  ../../src/gdb/arm-linux.c: No such file or directory

The reason for this is the ordering of build rules and make variables
in gdb/Makefile.in, specifically, the placement of the tags related
rules, and the ALLDEPFILES variable.  The ordering is like this:

  TAGFILES_NO_SRCDIR = .... $(ALLDEPFILES) ....

  TAGS: $(TAGFILES_NO_SRCDIR) ....
          # Recipe uses $(TAGFILES_NO_SRCDIR)

  tags: TAGS

  ALLDEPFILES = .....

When the TAGS rule is parsed TAGFILES_NO_SRCDIR is expanded, which
then expands ALLDEPFILES, which, at that point in the Makefile is
undefined, and so expands to the empty string.  As a result TAGS does
not depend on any file listed in ALLDEPFILES.

However, when the TAGS recipe is invoked ALLDEPFILES is now defined.
As a result, all the files in ALLDEPFILES are passed to the etags
program.

The ALLDEPFILES references three files, arm.c, arm-get-next-pcs.c, and
arm-linux.c, which are actually in the gdb/arch/ directory, but, in
ALLDEPFILES these files don't include the arch/ prefix.  As a result,
the etags program ends up looking for these files in the wrong
location.

As ALLDEPFILES is only used by the TAGS rule, this mistake was not
previously noticed (the TAGS rule itself was broken until a recent
commit).

In this commit I make two changes, first, I move ALLDEPFILES to be
defined before TAGFILES_NO_SRCDIR, this means that the TAGS rule will
depend on all the files in ALLDEPFILES.  With this change the TAGS
rule now breaks complaining that there's no rule to build the 3 files
mentioned above.

Next, I have added all *.c files in gdb/arch/ to ALLDEPFILES,
including their arch/ prefix, and removed the incorrect (missing arch/
prefix) references.

With these two changes the TAGS (or tags if you prefer) target now
builds without any errors or warnings.

gdb/Makefile.in

index 3df09e6a43bdcec4e9d605ef786039cc1b2b77e4..a775b2f4d191146c95a68bc6748b6ec66f6b17cd 100644 (file)
@@ -1589,6 +1589,235 @@ HFILES_WITH_SRCDIR = \
 
 DEPFILES = $(TARGET_OBS) $(SER_HARDWIRE) $(NATDEPFILES) $(SIM_OBS)
 
+ALLDEPFILES = \
+       arch/aarch32.c \
+       arch/aarch64.c \
+       arch/aarch64-insn.c \
+       arch/aarch64-mte-linux.c \
+       arch/amd64.c \
+       arch/arc.c \
+       arch/arm.c \
+       arch/arm-get-next-pcs.c \
+       arch/arm-linux.c \
+       arch/i386.c \
+       arch/loongarch.c \
+       arch/ppc-linux-common.c \
+       arch/riscv.c \
+       arch/tic6x.c \
+       aarch32-tdep.c \
+       aarch64-fbsd-nat.c \
+       aarch64-fbsd-tdep.c \
+       aarch64-linux-nat.c \
+       aarch64-linux-tdep.c \
+       aarch64-newlib-tdep.c \
+       aarch64-ravenscar-thread.c \
+       aarch64-tdep.c \
+       aix-thread.c \
+       alpha-bsd-nat.c \
+       alpha-bsd-tdep.c \
+       alpha-linux-nat.c \
+       alpha-linux-tdep.c \
+       alpha-mdebug-tdep.c \
+       alpha-netbsd-tdep.c \
+       alpha-obsd-tdep.c \
+       alpha-tdep.c \
+       amd64-bsd-nat.c \
+       amd64-darwin-tdep.c \
+       amd64-dicos-tdep.c \
+       amd64-fbsd-nat.c \
+       amd64-fbsd-tdep.c \
+       amd64-linux-nat.c \
+       amd64-linux-tdep.c \
+       amd64-nat.c \
+       amd64-netbsd-nat.c \
+       amd64-netbsd-tdep.c \
+       amd64-obsd-nat.c \
+       amd64-obsd-tdep.c \
+       amd64-ravenscar-thread.c \
+       amd64-sol2-tdep.c \
+       amd64-tdep.c \
+       arc-linux-nat.c \
+       arc-tdep.c \
+       arm-bsd-tdep.c \
+       arm-fbsd-nat.c \
+       arm-fbsd-tdep.c \
+       arm-linux-nat.c \
+       arm-linux-tdep.c \
+       arm-netbsd-nat.c \
+       arm-netbsd-tdep.c \
+       arm-none-tdep.c \
+       arm-obsd-tdep.c \
+       arm-tdep.c \
+       avr-tdep.c \
+       bfin-linux-tdep.c \
+       bfin-tdep.c \
+       bpf-tdep.c \
+       bsd-kvm.c \
+       bsd-uthread.c \
+       csky-linux-tdep.c \
+       csky-tdep.c \
+       darwin-nat.c \
+       dicos-tdep.c \
+       fbsd-nat.c \
+       fbsd-tdep.c \
+       fork-child.c \
+       ft32-tdep.c \
+       glibc-tdep.c \
+       go32-nat.c \
+       h8300-tdep.c \
+       hppa-bsd-tdep.c \
+       hppa-linux-nat.c \
+       hppa-linux-tdep.c \
+       hppa-netbsd-nat.c \
+       hppa-netbsd-tdep.c \
+       hppa-obsd-nat.c \
+       hppa-obsd-tdep.c \
+       hppa-tdep.c \
+       i386-bsd-nat.c \
+       i386-bsd-tdep.c \
+       i386-darwin-nat.c \
+       i386-darwin-tdep.c \
+       i386-dicos-tdep.c \
+       i386-fbsd-nat.c \
+       i386-fbsd-tdep.c \
+       i386-gnu-nat.c \
+       i386-gnu-tdep.c \
+       i386-linux-nat.c \
+       i386-linux-tdep.c \
+       i386-netbsd-nat.c \
+       i386-netbsd-tdep.c \
+       i386-obsd-nat.c \
+       i386-obsd-tdep.c \
+       i386-sol2-nat.c \
+       i386-sol2-tdep.c \
+       i386-tdep.c \
+       i386-windows-tdep.c \
+       i387-tdep.c \
+       ia64-libunwind-tdep.c \
+       ia64-linux-nat.c \
+       ia64-linux-tdep.c \
+       ia64-tdep.c \
+       ia64-vms-tdep.c \
+       inf-ptrace.c \
+       linux-fork.c \
+       linux-record.c \
+       linux-tdep.c \
+       lm32-tdep.c \
+       loongarch-linux-nat.c \
+       loongarch-linux-tdep.c \
+       loongarch-tdep.c \
+       m32r-linux-nat.c \
+       m32r-linux-tdep.c \
+       m32r-tdep.c \
+       m68hc11-tdep.c \
+       m68k-bsd-nat.c \
+       m68k-bsd-tdep.c \
+       m68k-linux-nat.c \
+       m68k-linux-tdep.c \
+       m68k-tdep.c \
+       microblaze-linux-tdep.c \
+       microblaze-tdep.c \
+       mingw-hdep.c \
+       mips-fbsd-nat.c \
+       mips-fbsd-tdep.c \
+       mips-linux-nat.c \
+       mips-linux-tdep.c \
+       mips-netbsd-nat.c \
+       mips-netbsd-tdep.c \
+       mips-sde-tdep.c \
+       mips-tdep.c \
+       mips64-obsd-nat.c \
+       mips64-obsd-tdep.c \
+       msp430-tdep.c \
+       netbsd-nat.c \
+       netbsd-tdep.c \
+       nds32-tdep.c \
+       nios2-linux-tdep.c \
+       nios2-tdep.c \
+       obsd-nat.c \
+       obsd-tdep.c \
+       or1k-linux-nat.c \
+       posix-hdep.c \
+       ppc-fbsd-nat.c \
+       ppc-fbsd-tdep.c \
+       ppc-linux-nat.c \
+       ppc-linux-tdep.c \
+       ppc-netbsd-nat.c \
+       ppc-netbsd-tdep.c \
+       ppc-obsd-nat.c \
+       ppc-obsd-tdep.c \
+       ppc-ravenscar-thread.c \
+       ppc-sysv-tdep.c \
+       ppc64-tdep.c \
+       procfs.c \
+       ravenscar-thread.c \
+       remote-sim.c \
+       riscv-fbsd-nat.c \
+       riscv-fbsd-tdep.c \
+       riscv-linux-nat.c \
+       riscv-linux-tdep.c \
+       riscv-none-tdep.c \
+       riscv-ravenscar-thread.c \
+       riscv-tdep.c \
+       rl78-tdep.c \
+       rs6000-aix-nat.c \
+       rs6000-lynx178-tdep.c \
+       rs6000-tdep.c \
+       rx-tdep.c \
+       s390-linux-nat.c \
+       s390-linux-tdep.c \
+       s390-tdep.c \
+       ser-go32.c \
+       ser-mingw.c \
+       ser-pipe.c \
+       ser-tcp.c \
+       ser-uds.c \
+       sh-netbsd-nat.c \
+       sh-netbsd-tdep.c \
+       sh-tdep.c \
+       sol2-tdep.c \
+       solib-aix.c \
+       solib-svr4.c \
+       sparc-linux-nat.c \
+       sparc-linux-tdep.c \
+       sparc-nat.c \
+       sparc-netbsd-nat.c \
+       sparc-netbsd-tdep.c \
+       sparc-obsd-tdep.c \
+       sparc-ravenscar-thread.c \
+       sparc-sol2-nat.c \
+       sparc-sol2-tdep.c \
+       sparc-tdep.c \
+       sparc64-fbsd-nat.c \
+       sparc64-fbsd-tdep.c \
+       sparc64-linux-nat.c \
+       sparc64-linux-tdep.c \
+       sparc64-nat.c \
+       sparc64-netbsd-nat.c \
+       sparc64-netbsd-tdep.c \
+       sparc64-obsd-nat.c \
+       sparc64-obsd-tdep.c \
+       sparc64-sol2-tdep.c \
+       sparc64-tdep.c \
+       tilegx-linux-nat.c \
+       tilegx-linux-tdep.c \
+       tilegx-tdep.c \
+       v850-tdep.c \
+       vax-bsd-nat.c \
+       vax-netbsd-tdep.c \
+       vax-tdep.c \
+       windows-nat.c \
+       windows-tdep.c \
+       x86-nat.c \
+       x86-tdep.c \
+       xcoffread.c \
+       xstormy16-tdep.c \
+       xtensa-config.c \
+       xtensa-linux-nat.c \
+       xtensa-linux-tdep.c \
+       xtensa-tdep.c \
+       xtensa-xtregs.c
+
 # Don't include YYFILES (*.c) because we already include *.y in SFILES,
 # and it's more useful to see it in the .y file.
 TAGFILES_NO_SRCDIR = $(SFILES) $(HFILES_NO_SRCDIR) $(ALLDEPFILES) \
@@ -2132,224 +2361,6 @@ force_update:
 # will remove them.
 MAKEOVERRIDES =
 
-ALLDEPFILES = \
-       aarch32-tdep.c \
-       aarch64-fbsd-nat.c \
-       aarch64-fbsd-tdep.c \
-       aarch64-linux-nat.c \
-       aarch64-linux-tdep.c \
-       aarch64-newlib-tdep.c \
-       aarch64-ravenscar-thread.c \
-       aarch64-tdep.c \
-       aix-thread.c \
-       alpha-bsd-nat.c \
-       alpha-bsd-tdep.c \
-       alpha-linux-nat.c \
-       alpha-linux-tdep.c \
-       alpha-mdebug-tdep.c \
-       alpha-netbsd-tdep.c \
-       alpha-obsd-tdep.c \
-       alpha-tdep.c \
-       amd64-bsd-nat.c \
-       amd64-darwin-tdep.c \
-       amd64-dicos-tdep.c \
-       amd64-fbsd-nat.c \
-       amd64-fbsd-tdep.c \
-       amd64-linux-nat.c \
-       amd64-linux-tdep.c \
-       amd64-nat.c \
-       amd64-netbsd-nat.c \
-       amd64-netbsd-tdep.c \
-       amd64-obsd-nat.c \
-       amd64-obsd-tdep.c \
-       amd64-ravenscar-thread.c \
-       amd64-sol2-tdep.c \
-       amd64-tdep.c \
-       arc-linux-nat.c \
-       arc-tdep.c \
-       arm.c \
-       arm-bsd-tdep.c \
-       arm-fbsd-nat.c \
-       arm-fbsd-tdep.c \
-       arm-get-next-pcs.c \
-       arm-linux.c \
-       arm-linux-nat.c \
-       arm-linux-tdep.c \
-       arm-netbsd-nat.c \
-       arm-netbsd-tdep.c \
-       arm-none-tdep.c \
-       arm-obsd-tdep.c \
-       arm-tdep.c \
-       avr-tdep.c \
-       bfin-linux-tdep.c \
-       bfin-tdep.c \
-       bpf-tdep.c \
-       bsd-kvm.c \
-       bsd-uthread.c \
-       csky-linux-tdep.c \
-       csky-tdep.c \
-       darwin-nat.c \
-       dicos-tdep.c \
-       fbsd-nat.c \
-       fbsd-tdep.c \
-       fork-child.c \
-       ft32-tdep.c \
-       glibc-tdep.c \
-       go32-nat.c \
-       h8300-tdep.c \
-       hppa-bsd-tdep.c \
-       hppa-linux-nat.c \
-       hppa-linux-tdep.c \
-       hppa-netbsd-nat.c \
-       hppa-netbsd-tdep.c \
-       hppa-obsd-nat.c \
-       hppa-obsd-tdep.c \
-       hppa-tdep.c \
-       i386-bsd-nat.c \
-       i386-bsd-tdep.c \
-       i386-darwin-nat.c \
-       i386-darwin-tdep.c \
-       i386-dicos-tdep.c \
-       i386-fbsd-nat.c \
-       i386-fbsd-tdep.c \
-       i386-gnu-nat.c \
-       i386-gnu-tdep.c \
-       i386-linux-nat.c \
-       i386-linux-tdep.c \
-       i386-netbsd-nat.c \
-       i386-netbsd-tdep.c \
-       i386-obsd-nat.c \
-       i386-obsd-tdep.c \
-       i386-sol2-nat.c \
-       i386-sol2-tdep.c \
-       i386-tdep.c \
-       i386-windows-tdep.c \
-       i387-tdep.c \
-       ia64-libunwind-tdep.c \
-       ia64-linux-nat.c \
-       ia64-linux-tdep.c \
-       ia64-tdep.c \
-       ia64-vms-tdep.c \
-       inf-ptrace.c \
-       linux-fork.c \
-       linux-record.c \
-       linux-tdep.c \
-       lm32-tdep.c \
-       loongarch-linux-nat.c \
-       loongarch-linux-tdep.c \
-       loongarch-tdep.c \
-       m32r-linux-nat.c \
-       m32r-linux-tdep.c \
-       m32r-tdep.c \
-       m68hc11-tdep.c \
-       m68k-bsd-nat.c \
-       m68k-bsd-tdep.c \
-       m68k-linux-nat.c \
-       m68k-linux-tdep.c \
-       m68k-tdep.c \
-       microblaze-linux-tdep.c \
-       microblaze-tdep.c \
-       mingw-hdep.c \
-       mips-fbsd-nat.c \
-       mips-fbsd-tdep.c \
-       mips-linux-nat.c \
-       mips-linux-tdep.c \
-       mips-netbsd-nat.c \
-       mips-netbsd-tdep.c \
-       mips-sde-tdep.c \
-       mips-tdep.c \
-       mips64-obsd-nat.c \
-       mips64-obsd-tdep.c \
-       msp430-tdep.c \
-       netbsd-nat.c \
-       netbsd-tdep.c \
-       nds32-tdep.c \
-       nios2-linux-tdep.c \
-       nios2-tdep.c \
-       obsd-nat.c \
-       obsd-tdep.c \
-       or1k-linux-nat.c \
-       posix-hdep.c \
-       ppc-fbsd-nat.c \
-       ppc-fbsd-tdep.c \
-       ppc-linux-nat.c \
-       ppc-linux-tdep.c \
-       ppc-netbsd-nat.c \
-       ppc-netbsd-tdep.c \
-       ppc-obsd-nat.c \
-       ppc-obsd-tdep.c \
-       ppc-ravenscar-thread.c \
-       ppc-sysv-tdep.c \
-       ppc64-tdep.c \
-       procfs.c \
-       ravenscar-thread.c \
-       remote-sim.c \
-       riscv-fbsd-nat.c \
-       riscv-fbsd-tdep.c \
-       riscv-linux-nat.c \
-       riscv-linux-tdep.c \
-       riscv-none-tdep.c \
-       riscv-ravenscar-thread.c \
-       riscv-tdep.c \
-       rl78-tdep.c \
-       rs6000-aix-nat.c \
-       rs6000-lynx178-tdep.c \
-       rs6000-tdep.c \
-       rx-tdep.c \
-       s390-linux-nat.c \
-       s390-linux-tdep.c \
-       s390-tdep.c \
-       ser-go32.c \
-       ser-mingw.c \
-       ser-pipe.c \
-       ser-tcp.c \
-       ser-uds.c \
-       sh-netbsd-nat.c \
-       sh-netbsd-tdep.c \
-       sh-tdep.c \
-       sol2-tdep.c \
-       solib-aix.c \
-       solib-svr4.c \
-       sparc-linux-nat.c \
-       sparc-linux-tdep.c \
-       sparc-nat.c \
-       sparc-netbsd-nat.c \
-       sparc-netbsd-tdep.c \
-       sparc-obsd-tdep.c \
-       sparc-ravenscar-thread.c \
-       sparc-sol2-nat.c \
-       sparc-sol2-tdep.c \
-       sparc-tdep.c \
-       sparc64-fbsd-nat.c \
-       sparc64-fbsd-tdep.c \
-       sparc64-linux-nat.c \
-       sparc64-linux-tdep.c \
-       sparc64-nat.c \
-       sparc64-netbsd-nat.c \
-       sparc64-netbsd-tdep.c \
-       sparc64-obsd-nat.c \
-       sparc64-obsd-tdep.c \
-       sparc64-sol2-tdep.c \
-       sparc64-tdep.c \
-       tilegx-linux-nat.c \
-       tilegx-linux-tdep.c \
-       tilegx-tdep.c \
-       v850-tdep.c \
-       vax-bsd-nat.c \
-       vax-netbsd-tdep.c \
-       vax-tdep.c \
-       windows-nat.c \
-       windows-tdep.c \
-       x86-nat.c \
-       x86-tdep.c \
-       xcoffread.c \
-       xstormy16-tdep.c \
-       xtensa-config.c \
-       xtensa-linux-nat.c \
-       xtensa-linux-tdep.c \
-       xtensa-tdep.c \
-       xtensa-xtregs.c
-
 # Some files need explicit build rules (due to -Werror problems) or due
 # to sub-directory fun 'n' games.