git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [RFC/PATCH] Avoid TAGS/tags warning from GNU Make

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 4, 2010, 16:14 UTC
Message-ID
<7v8w3hxz81.fsf@alter.siamese.dyndns.org>
In-Reply-To
<vpqeid97sn6.fsf@bauges.imag.fr>
Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:
Show 15 quoted lines
> Jonathan Nieder <jrnieder@gmail.com> writes:
>
>> From: Johannes Schindelin <johannes.schindelin@gmx.de>
>> Date: Thu, 22 Oct 2009 19:04:17 +0200
>>
>> MinGW make considers the TAGS and tags targets to refer to
>> the same file:
>>
>>  Makefile: warning: overriding commands for target `TAGS'
>>  Makefile: warning: ignoring old commands for target `TAGS'
>>
>> Suppress both targets on that platform.
>
> Wouldn't it be more sensible to rename them (like ETAGS/CTAGS) on
> mingw instead, in case someone wants to use these files on windows?

I think that makes much more sense. How about doing it that way, perhaps something like this?

By the way, doesn't case insensitive HFS+ have the same issue?

-- >8 -- [Subject] MinGW: avoid collisions between "tags" and "TAGS"

On case insensitive filesystems, "tags" and "TAGS" target will try to overwrite the same file. Allow MinGW to use "ETAGS" instead.

These two targets do produce real files; do not put them on .PHONY target list.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 Makefile |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/Makefile b/Makefile
index 8b7c243..d87efdd 100644
--- a/Makefile
+++ b/Makefile
@@ -390,6 +390,8 @@ SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH)) \
 	  $(patsubst %.py,%,$(SCRIPT_PYTHON)) \
 	  git-instaweb
 
+ETAGS_TARGET = TAGS
+
 # Empty...
 EXTRA_PROGRAMS =
 
@@ -1120,6 +1122,7 @@ ifneq (,$(findstring MINGW,$(uname_S)))
 	NO_REGEX = YesPlease
 	NO_PYTHON = YesPlease
 	BLK_SHA1 = YesPlease
+	ETAGS_TARGET = ETAGS
 	COMPAT_CFLAGS += -D__USE_MINGW_ACCESS -DNOGDI -Icompat -Icompat/fnmatch -Icompat/win32
 	COMPAT_CFLAGS += -DSTRIP_EXTENSION=\".exe\"
 	COMPAT_OBJS += compat/mingw.o compat/fnmatch/fnmatch.o compat/winansi.o \
@@ -1954,9 +1957,9 @@ info:
 pdf:
 	$(MAKE) -C Documentation pdf
 
-TAGS:
-	$(RM) TAGS
-	$(FIND) . -name '*.[hcS]' -print | xargs etags -a
+$(ETAGS_TARGET):
+	$(RM) $(ETAGS_TARGET)
+	$(FIND) . -name '*.[hcS]' -print | xargs etags -a -o $(ETAGS_TARGET)
 
 tags:
 	$(RM) tags
@@ -2228,7 +2231,7 @@ clean:
 	$(RM) $(TEST_PROGRAMS)
 	$(RM) -r bin-wrappers
 	$(RM) -r $(dep_dirs)
-	$(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo common-cmds.h TAGS tags cscope*
+	$(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo common-cmds.h $(ETAGS_TARGET) tags cscope*
 	$(RM) -r autom4te.cache
 	$(RM) config.log config.mak.autogen config.mak.append config.status config.cache
 	$(RM) -r $(GIT_TARNAME) .doc-tmp-dir
@@ -2252,7 +2255,7 @@ endif
 
 .PHONY: all install clean strip
 .PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell
-.PHONY: FORCE TAGS tags cscope
+.PHONY: FORCE cscope
 
 ### Check documentation
 #
Previous: Matthieu MoyNext: Jonathan Nieder
Message 3 of 4 in “Avoid TAGS/tags warning from GNU Make”
  1. Avoid TAGS/tags warning from GNU MakeJonathan Nieder, Sep 4, 2010
  2. Matthieu MoySep 4, 2010
  3. Junio C HamanoSep 4, 2010
  4. Jonathan NiederSep 4, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.