Skip to content

Commit 1816bf2

Browse files
davvidgitster
authored andcommitted
Makefile: Improve compiler header dependency check
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 111ee18 commit 1816bf2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1234,9 +1234,9 @@ COMPUTE_HEADER_DEPENDENCIES =
12341234
USE_COMPUTED_HEADER_DEPENDENCIES =
12351235
else
12361236
ifndef COMPUTE_HEADER_DEPENDENCIES
1237-
dep_check = $(shell sh -c \
1238-
'$(CC) -c -MF /dev/null -MMD -MP -x c /dev/null -o /dev/null 2>&1; \
1239-
echo $$?')
1237+
dep_check = $(shell $(CC) $(ALL_CFLAGS) \
1238+
-c -MF /dev/null -MMD -MP -x c /dev/null -o /dev/null 2>&1; \
1239+
echo $$?)
12401240
ifeq ($(dep_check),0)
12411241
COMPUTE_HEADER_DEPENDENCIES=YesPlease
12421242
endif

0 commit comments

Comments
 (0)