summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2011-10-05 12:36:16 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2011-10-05 12:36:16 -0700
commit7af4d3468f79c39a75e59aa9699d43d1bbbfd1af (patch)
tree7f3c8ce64ad79f38ed0f54a0bfedd3519d5e3c82
parentMerge branch 'ms/patch-id-with-overlong-line' (diff)
parentMakefile: Use computed header dependencies if the compiler supports it (diff)
downloadtgif-7af4d3468f79c39a75e59aa9699d43d1bbbfd1af.tar.xz
Merge branch 'fk/make-auto-header-dependencies'
* fk/make-auto-header-dependencies: Makefile: Use computed header dependencies if the compiler supports it
-rw-r--r--Makefile13
1 files changed, 9 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index 8d6d4515d2..15fb8c23a3 100644
--- a/Makefile
+++ b/Makefile
@@ -250,10 +250,6 @@ all::
# DEFAULT_EDITOR='$GIT_FALLBACK_EDITOR',
# DEFAULT_EDITOR='"C:\Program Files\Vim\gvim.exe" --nofork'
#
-# Define COMPUTE_HEADER_DEPENDENCIES if your compiler supports the -MMD option
-# and you want to avoid rebuilding objects when an unrelated header file
-# changes.
-#
# Define CHECK_HEADER_DEPENDENCIES to check for problems in the hard-coded
# dependency rules.
#
@@ -1242,6 +1238,15 @@ endif
ifdef CHECK_HEADER_DEPENDENCIES
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 $$?')
+ifeq ($(dep_check),0)
+COMPUTE_HEADER_DEPENDENCIES=YesPlease
+endif
+endif
endif
ifdef COMPUTE_HEADER_DEPENDENCIES