summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2020-03-26 08:06:45 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-03-27 22:11:53 (GMT)
commit94a88e2524a7243fe77d42faa5649e1c38d1b292 (patch)
tree7a1152a69d71d44a31f0767702a6ceb3b37a51c5 /Makefile
parent274b9cc25322d9ee79aa8e6d4e86f0ffe5ced925 (diff)
downloadgit-94a88e2524a7243fe77d42faa5649e1c38d1b292.zip
git-94a88e2524a7243fe77d42faa5649e1c38d1b292.tar.gz
git-94a88e2524a7243fe77d42faa5649e1c38d1b292.tar.bz2
Makefile: avoid running curl-config multiple times
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> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile7
1 files changed, 3 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index 9804a07..eaf56e2 100644
--- a/Makefile
+++ b/Makefile
@@ -1364,11 +1364,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