All of lore.kernel.org
 help / color / mirror / Atom feed
From: Fredrik Kuivinen <frekui@gmail.com>
To: git@vger.kernel.org
Cc: Fredrik Kuivinen <frekui@gmail.com>,
	Jonathan Nieder <jrnieder@gmail.com>
Subject: [PATCH resend] Makefile: Use computed header dependencies if the compiler supports it
Date: Sun, 14 Aug 2011 20:45:12 +0200	[thread overview]
Message-ID: <1313347512-7815-1-git-send-email-frekui@gmail.com> (raw)

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>
---

This is a resend, it has been rebased on top of master but otherwise
the same patch was sent 2011-06-11. Jonathan Nieder has been added to
the Cc list as he implemented the computed header dependencies
feature.

 Makefile |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index 8dd782f..c289074 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.
 #
@@ -1236,6 +1232,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

             reply	other threads:[~2011-08-14 18:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-14 18:45 Fredrik Kuivinen [this message]
2011-08-14 19:00 ` [PATCH resend] Makefile: Use computed header dependencies if the compiler supports it Jonathan Nieder
2011-08-14 19:53   ` Fredrik Kuivinen
2011-08-14 20:02     ` Jonathan Nieder
2011-08-18 18:34       ` Fredrik Kuivinen
2011-08-18 18:41         ` Jonathan Nieder

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1313347512-7815-1-git-send-email-frekui@gmail.com \
    --to=frekui@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=jrnieder@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.