From: Jonathan Nieder <jrnieder@gmail.com>
To: Fredrik Kuivinen <frekui@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH resend] Makefile: Use computed header dependencies if the compiler supports it
Date: Sun, 14 Aug 2011 14:00:50 -0500 [thread overview]
Message-ID: <20110814190050.GA16819@elie.gateway.2wire.net> (raw)
In-Reply-To: <1313347512-7815-1-git-send-email-frekui@gmail.com>
Hi,
Fredrik Kuivinen wrote:
> 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.
Yes! Thanks for this.
I have a few thoughts about the implementation:
> --- a/Makefile
> +++ b/Makefile
[...]
> @@ -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
This causes "make foo" to run gcc and create a temporary file
unconditionally, regardless of what foo is. In an ideal world:
- the autodetection would only happen when building targets that
care about it
- the detection would happen once (creating some file to store the
result) and not be repeated with each invocation of "make"
- (maybe) there would be a way to override the detection with
either a "yes" or "no" result, for those who really care to
save a little time.
I was about to say that the GIT_VERSION variable has some of these
properties, but now that I check, from the point of view of the
Makefile it doesn't. ./GIT-VERSION-GEN is just very fast. :)
I wonder if we can make do with a faster check, like
$(CC) -c -MF /dev/null -MMD -MP git.c --help >/dev/null 2>&1
What do you think?
next prev parent reply other threads:[~2011-08-14 19:02 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-14 18:45 [PATCH resend] Makefile: Use computed header dependencies if the compiler supports it Fredrik Kuivinen
2011-08-14 19:00 ` Jonathan Nieder [this message]
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=20110814190050.GA16819@elie.gateway.2wire.net \
--to=jrnieder@gmail.com \
--cc=frekui@gmail.com \
--cc=git@vger.kernel.org \
/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 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).