* [PATCH] Makefile: Use computed header dependencies if the compiler supports it
@ 2011-06-28 9:21 Fredrik Kuivinen
0 siblings, 0 replies; only message in thread
From: Fredrik Kuivinen @ 2011-06-28 9:21 UTC (permalink / raw)
To: git; +Cc: Fredrik Kuivinen
Previously you had to manually define COMPUTE_HEADER_DEPENDENCIES to
enable this feature. It seemed a bit sad that such a useful feature
had to be enabled manually.
Signed-off-by: Fredrik Kuivinen <frekui@gmail.com>
---
Makefile | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/Makefile b/Makefile
index e40ac0c..3b9efac 100644
--- a/Makefile
+++ b/Makefile
@@ -243,10 +243,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.
#
@@ -1211,6 +1207,15 @@ endif
ifdef CHECK_HEADER_DEPENDENCIES
COMPUTE_HEADER_DEPENDENCIES =
USE_COMPUTED_HEADER_DEPENDENCIES =
+else
+dep_check = $(shell sh -c \
+ ': > ++empty.c; \
+ $(CC) -c -MF /dev/null -MMD -MP ++empty.c -o /dev/null 2>&1; \
+ echo $$?; \
+ $(RM) ++empty.c')
+ifeq ($(dep_check),0)
+COMPUTE_HEADER_DEPENDENCIES=YesPlease
+endif
endif
ifdef COMPUTE_HEADER_DEPENDENCIES
--
1.7.5.3.368.g8b1b7.dirty
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2011-06-28 9:24 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-28 9:21 [PATCH] Makefile: Use computed header dependencies if the compiler supports it Fredrik Kuivinen
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).