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

[PATCH] Makefile: Improve compiler header dependency check

From
David Aguilar <davvid@gmail.com>
Date
Aug 27, 2011, 08:41 UTC
Message-ID
<1314434470-7988-1-git-send-email-davvid@gmail.com>

The Makefile enables CHECK_HEADER_DEPENDENCIES when the compiler supports generating header dependencies. Make the check use the same flags as the invocation to avoid a false positive when user-configured compiler flags contain incompatible options.

Signed-off-by: David Aguilar <davvid@gmail.com>
---
I fired up git's next branch on a mac laptop where I
have a config.mak that builds universal git binaries:
CFLAGS = -arch i386 -arch x86_64

This configuration broke when 111ee18c31f9bac9436426399355facc79238566 was merged into next. gcc cannot generate header dependencies when multiple -arch statements are used but the test generated a false positive.

 Makefile |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/Makefile b/Makefile
index aa67142..30f3812 100644
--- a/Makefile
+++ b/Makefile
@@ -1251,7 +1251,8 @@ 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; \
+	'$(CC) -c -MF /dev/null -MMD -MP -x c /dev/null -o /dev/null \
+	$(ALL_CFLAGS) $(EXTRA_CPPFLAGS) 2>&1; \
 	echo $$?')
 ifeq ($(dep_check),0)
 COMPUTE_HEADER_DEPENDENCIES=YesPlease
-- 
1.7.6.476.g57292
Next: Jonathan Nieder
Message 1 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.