git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Makefile: Improve compiler header dependency check
@ 2011-08-27  8:41 David Aguilar
  2011-08-27 16:26 ` Jonathan Nieder
  0 siblings, 1 reply; 9+ messages in thread
From: David Aguilar @ 2011-08-27  8:41 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Jonathan Nieder, Fredrik Kuivinen, git

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

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2011-08-30 17:17 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-27  8:41 [PATCH] Makefile: Improve compiler header dependency check David Aguilar
2011-08-27 16:26 ` Jonathan Nieder
2011-08-27 21:00   ` [PATCH v2] " David Aguilar
2011-08-28 11:47     ` Fredrik Kuivinen
2011-08-30  4:05       ` Jonathan Nieder
2011-08-30  8:27         ` [PATCH v3] " David Aguilar
2011-08-30  8:33           ` Jonathan Nieder
2011-08-30 17:17           ` Junio C Hamano
2011-08-27 21:19   ` [PATCH] " David Aguilar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).