From: Jeff King <peff@peff.net>
To: Ramsay Jones <ramsay@ramsayjones.plus.com>
Cc: GIT Mailing-list <git@vger.kernel.org>,
Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH 2/8] Documentation/Makefile: conditionally include ../GIT-VERSION-FILE
Date: Fri, 6 Nov 2020 15:56:18 -0500 [thread overview]
Message-ID: <20201106205618.GA197338@coredump.intra.peff.net> (raw)
In-Reply-To: <a654c95f-2367-5805-d4f8-56c466a141d4@ramsayjones.plus.com>
On Fri, Nov 06, 2020 at 07:38:06PM +0000, Ramsay Jones wrote:
> I hadn't done so yet, but I had planned to modify the GIT-VERSION-GEN script
> (with -v parameter, say) to just output the version to stdout, because it
> would save a sed invocation. It currently looks something like this:
>
> diff --git a/Makefile b/Makefile
> index 372139f1f2..f166fbe067 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -493,7 +493,11 @@ all::
>
> GIT-VERSION-FILE: FORCE
> @$(SHELL_PATH) ./GIT-VERSION-GEN
> --include GIT-VERSION-FILE
> +
> +ifeq ($(wildcard GIT-VERSION-FILE),)
> +$(shell ./GIT-VERSION-GEN)
> +endif
> +GIT_VERSION = $(eval GIT_VERSION := $$(shell cat GIT-VERSION-FILE | sed -e 's/^GIT_VERSION = //'))$(GIT_VERSION)
Yeah, not too surprising. If we grow a lot of these fill-in-the-value
stubs, it might be worth abstracting it out into a function (using
$(call) should be OK, as even Apple's ancient version of GNU make has
it).
I do think the one that evals an "include" might end up being more
readable and flexible, though. I'm not sure if the include needs to be
more aggressive about using ":=" though (in a simple test it didn't seem
to be, and since we'll be filling in a concrete value that's OK to
evaluate multiple times, I think it would be OK).
> Ignore the 'ifeq' for now (I had several versions, including getting rid
> of the GIT-VERSION-FILE rule, but that caused problems without changing
> the Documentation/Makefile, and several others ... (including in contrib)).
Yeah, I didn't look at all at what complications we might get from other
Makefiles. Though if everything is literally running `GIT-VERSION-GEN`
directly then I think they could all use the same code.
> So, I haven't worked everything out yet, but I had planned to look at
> this next.
Sounds good. I mostly wanted to plant the seed in your head. Finding
that it was already growing is better still. :)
-Peff
next prev parent reply other threads:[~2020-11-06 20:56 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-05 21:03 [PATCH 2/8] Documentation/Makefile: conditionally include ../GIT-VERSION-FILE Ramsay Jones
2020-11-05 21:52 ` Junio C Hamano
2020-11-06 1:30 ` Ramsay Jones
2020-11-06 18:18 ` Jeff King
2020-11-06 19:38 ` Ramsay Jones
2020-11-06 20:56 ` Jeff King [this message]
2020-11-06 21:43 ` Junio C Hamano
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201106205618.GA197338@coredump.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=ramsay@ramsayjones.plus.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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).