Re: [PATCH] Get make TAGS to work in gdb directory

Nick Roberts
2005-09-28T03:23:18Z

Kris Warkentin writes:
> Wow! I had no idea that even existed. I always just did ctags `find .
> -name "*.[ch]"`. I suppose that the make TAGS is smart enough to only
> generate tags for the source files that have been configured for your
> target? How handy!

Actually, it creates TAGS for files that aren't compiled through ALLDEPFILES.
However it finds the tags for the source files that have been configured
first:

# Put the proper machine-specific files first, so M-. on a machine
# specific routine gets the one for the correct machine. (FIXME: those
# files go in twice; we should be removing them from the main list).

So in my case I find child_wait in linux-nat.c (compiled as part of my gdb)
and then inftarg.c (not compiled).

That comment and this one:

# Header files that need to have srcdir added. Note that in the cases
# where we use a macro like $(gdbcmd_h), things are carefully arranged
# so that each .h file is listed exactly once (M-x tags-search works
# wrong if TAGS has files twice). Because this is tricky to get
# right, it is probably easiest just to list .h files here directly.

seem inaccurate in that etags seems to ignore duplicate file names.

It might make sense just to include files that are configured in that if users
want them all they can just use ctags/etags directly as you have done. In any
case there seem to be other files in COMMON_OBS for which TAGS should be
generated e.g. annotate.c.

How about the patch below?

Nick

*** Makefile.in.~1.755~ 2005-09-28 15:08:01.000000000 +1200
--- Makefile.in 2005-09-28 15:10:07.388706664 +1200
***************
*** 886,897 ****
SOURCES = $(SFILES) $(ALLDEPFILES) $(YYFILES) $(CONFIG_SRCS)
# 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) \
$(CONFIG_SRCS)
TAGFILES_WITH_SRCDIR = $(HFILES_WITH_SRCDIR)

! COMMON_OBS = $(DEPFILES) $(CONFIG_OBS) $(YYOBJ) \
! version.o \
annotate.o \
auxv.o \
bfd-target.o \
--- 886,898 ----
SOURCES = $(SFILES) $(ALLDEPFILES) $(YYFILES) $(CONFIG_SRCS)
# 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) $(OTHER_COMMON_OBS) \
$(CONFIG_SRCS)
TAGFILES_WITH_SRCDIR = $(HFILES_WITH_SRCDIR)

! COMMON_OBS = $(DEPFILES) $(CONFIG_OBS) $(YYOBJ) $(OTHER_COMMON_OBS)
!
! OTHER_COMMON_OBS = version.o \
annotate.o \
auxv.o \
bfd-target.o \