From: Jeff King <peff@peff.net>
To: git@vger.kernel.org
Subject: [PATCH 1/2] Makefile: avoid running curl-config multiple times
Date: Thu, 26 Mar 2020 04:06:45 -0400 [thread overview]
Message-ID: <20200326080645.GA2200716@coredump.intra.peff.net> (raw)
In-Reply-To: <20200326080540.GA2200522@coredump.intra.peff.net>
If the user hasn't set the CURL_LDFLAGS Makefile variable, we invoke
curl-config like this:
CURL_LIBCURL += $(shell $(CURL_CONFIG) --libs)
Because the shell function is run when the value is expanded, we invoke
curl-config each time we need to link something (which generally ends up
being four times for a full build).
Instead, let's use an immediate Makefile variable, which only needs
expanding once. We can't combine that with the existing "+=", but since
we only do this when CURL_LDFLAGS is undefined, we can just set that
variable.
That also allows us to simplify our conditional a bit, since both sides
will then put the result into CURL_LIBCURL. While we're touching it,
let's fix the indentation to match the nearby code (we're inside an
outer conditional, so everything else is indented one level).
Signed-off-by: Jeff King <peff@peff.net>
---
Makefile | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/Makefile b/Makefile
index a5961113d8..93a8ef3a72 100644
--- a/Makefile
+++ b/Makefile
@@ -1365,11 +1365,10 @@ else
CURL_LIBCURL =
endif
-ifdef CURL_LDFLAGS
+ ifndef CURL_LDFLAGS
+ CURL_LDFLAGS := $(shell $(CURL_CONFIG) --libs)
+ endif
CURL_LIBCURL += $(CURL_LDFLAGS)
-else
- CURL_LIBCURL += $(shell $(CURL_CONFIG) --libs)
-endif
REMOTE_CURL_PRIMARY = git-remote-http$X
REMOTE_CURL_ALIASES = git-remote-https$X git-remote-ftp$X git-remote-ftps$X
--
2.26.0.576.gb87790c3c1
next prev parent reply other threads:[~2020-03-26 8:06 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-26 8:05 [PATCH 0/2] use `curl-config --cflags` Jeff King
2020-03-26 8:06 ` Jeff King [this message]
2020-03-26 8:08 ` [PATCH 2/2] Makefile: use curl-config --cflags Jeff King
2020-03-27 22:12 ` [PATCH 0/2] use `curl-config --cflags` Junio C Hamano
2020-04-04 13:38 ` Johannes Schindelin
2020-04-04 14:58 ` [PATCH] Makefile: avoid running curl-config unnecessarily Jeff King
2020-04-05 1:33 ` Eric Sunshine
2020-04-05 18:44 ` Jeff King
2020-04-05 19:18 ` Eric Sunshine
2020-04-05 22:12 ` Johannes Schindelin
2020-04-05 22:12 ` Johannes Schindelin
2020-04-15 21:47 ` Junio C Hamano
2020-04-15 21:57 ` Jeff King
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=20200326080645.GA2200716@coredump.intra.peff.net \
--to=peff@peff.net \
--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.
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).