[PATCH v3] Makefile: Improve compiler header dependency check
- From
David Aguilar <davvid@gmail.com>
- Date
- Aug 30, 2011, 08:27 UTC
- Message-ID
- <1314692855-75113-1-git-send-email-davvid@gmail.com>
- In-Reply-To
- <20110830040515.GC6647@elie.gateway.2wire.net>
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
Make the check use the same flags as the invocation to avoid false positives when user-configured compiler flags contain incompatible options.
Signed-off-by: David Aguilar <davvid@gmail.com> --- Makefile | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/Makefile b/Makefile index aa67142..0ea1a2b 100644 --- a/Makefile +++ b/Makefile @@ -1250,9 +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; \ - 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
-- 1.7.7.rc0.326.gf688b5