git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Aguilar <davvid@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Jonathan Nieder <jrnieder@gmail.com>,
	Fredrik Kuivinen <frekui@gmail.com>,
	git@vger.kernel.org
Subject: [PATCH v2] Makefile: Improve compiler header dependency check
Date: Sat, 27 Aug 2011 14:00:44 -0700	[thread overview]
Message-ID: <1314478844-55379-1-git-send-email-davvid@gmail.com> (raw)
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

  reply	other threads:[~2011-08-27 21:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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   ` David Aguilar [this message]
2011-08-28 11:47     ` [PATCH v2] " 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1314478844-55379-1-git-send-email-davvid@gmail.com \
    --to=davvid@gmail.com \
    --cc=frekui@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jrnieder@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).