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

[PATCH v2] Makefile: Improve compiler header dependency check

From
David Aguilar <davvid@gmail.com>
Date
Aug 27, 2011, 21:00 UTC
Message-ID
<1314478844-55379-1-git-send-email-davvid@gmail.com>
In-Reply-To
<20110827162645.GA10476@elie.gateway.2wire.net>

Make the check use the same flags as the invocation to avoid false positives when user-configured compiler flags contain incompatible options.

For example, it is possible to build universal git binaries on OS X with the following snippet in config.mak:

	CFLAGS = -arch i386 -arch x86_64

111ee18c31f9bac9436426399355facc79238566 breaks this setup and results in the following error message:

	gcc-4.2: -E, -S, -save-temps and -M options are
	not allowed with multiple -arch flags

Include ALL_CFLAGS so that this and other conditions are caught. Use SHELL_PATH instead of assuming that "sh" is a sane shell.

Signed-off-by: David Aguilar <davvid@gmail.com>
---
I'm not sure if "sh -c" is necessary but I did notice that other
parts of the Makefile use $(SHELL_PATH).  The check was adjusted
to use that as well.
 Makefile |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile
index aa67142..9446a4e 100644
--- a/Makefile
+++ b/Makefile
@@ -1250,8 +1250,9 @@ COMPUTE_HEADER_DEPENDENCIES =
 USE_COMPUTED_HEADER_DEPENDENCIES =
 else
 ifndef COMPUTE_HEADER_DEPENDENCIES
-dep_check = $(shell sh -c \
-	'$(CC) -c -MF /dev/null -MMD -MP -x c /dev/null -o /dev/null 2>&1; \
+dep_check = $(shell $(SHELL_PATH) -c \
+	'$(CC) -c -MF /dev/null -MMD -MP -x c /dev/null -o /dev/null \
+	$(ALL_CFLAGS) 2>&1; \
 	echo $$?')
 ifeq ($(dep_check),0)
 COMPUTE_HEADER_DEPENDENCIES=YesPlease
-- 
1.7.7.rc0.308.gc820
Previous: Jonathan NiederNext: Fredrik Kuivinen
Message 3 of 9 in “Makefile: Improve compiler header dependency check”
  1. Makefile: Improve compiler header dependency checkDavid Aguilar, Aug 27, 2011
  2. Jonathan NiederAug 27, 2011
  3. Makefile: Improve compiler header dependency checkDavid Aguilar, Aug 27, 2011
  4. Fredrik KuivinenAug 28, 2011
  5. Jonathan NiederAug 30, 2011
  6. Makefile: Improve compiler header dependency checkDavid Aguilar, Aug 30, 2011
  7. Jonathan NiederAug 30, 2011
  8. Junio C HamanoAug 30, 2011
  9. David AguilarAug 27, 2011

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.