Skip to content

Commit 94a88e2

Browse files
peffgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 274b9cc commit 94a88e2

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

Makefile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1364,11 +1364,10 @@ else
13641364
CURL_LIBCURL =
13651365
endif
13661366

1367-
ifdef CURL_LDFLAGS
1367+
ifndef CURL_LDFLAGS
1368+
CURL_LDFLAGS := $(shell $(CURL_CONFIG) --libs)
1369+
endif
13681370
CURL_LIBCURL += $(CURL_LDFLAGS)
1369-
else
1370-
CURL_LIBCURL += $(shell $(CURL_CONFIG) --libs)
1371-
endif
13721371

13731372
REMOTE_CURL_PRIMARY = git-remote-http$X
13741373
REMOTE_CURL_ALIASES = git-remote-https$X git-remote-ftp$X git-remote-ftps$X

0 commit comments

Comments
 (0)