summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 111ee18)
raw | patch | inline | side by side (parent: 111ee18)
author | David Aguilar <davvid@gmail.com> | |
Tue, 30 Aug 2011 08:27:35 +0000 (01:27 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Tue, 30 Aug 2011 17:15:04 +0000 (10:15 -0700) |
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.
For example, without this patch, trying to build universal
binaries on a Mac using CFLAGS='-arch i386 -arch x86_64'
produces:
gcc-4.2: -E, -S, -save-temps and -M options are
not allowed with multiple -arch flags
While at it, remove "sh -c" in the command passed to $(shell);
at this point in the Makefile, SHELL has already been set to
a sensible shell and it is better not to override that.
Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
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.
For example, without this patch, trying to build universal
binaries on a Mac using CFLAGS='-arch i386 -arch x86_64'
produces:
gcc-4.2: -E, -S, -save-temps and -M options are
not allowed with multiple -arch flags
While at it, remove "sh -c" in the command passed to $(shell);
at this point in the Makefile, SHELL has already been set to
a sensible shell and it is better not to override that.
Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Makefile | patch | blob | history |
diff --git a/Makefile b/Makefile
index c131439a34a4d80e3c0ba35c13b2ccc53888538f..891e3b6f50cc9e7462983d71a6ff53ffa03ebbf0 100644 (file)
--- a/Makefile
+++ b/Makefile
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; \
- echo $$?')
+dep_check = $(shell $(CC) $(ALL_CFLAGS) \
+ -c -MF /dev/null -MMD -MP -x c /dev/null -o /dev/null 2>&1; \
+ echo $$?)
ifeq ($(dep_check),0)
COMPUTE_HEADER_DEPENDENCIES=YesPlease
endif