Skip to content

Commit 9eaa78b

Browse files
repkgitster
authored andcommitted
Makefile: link libcurl before zlib
For static linking especially library order while linking is important. For example, libcurl wants symbols from zlib when building http-push, http-fetch and remote-curl. So for these programs libcurl has to be linked before zlib. Signed-off-by: Remi Pommarel <[email protected]> Reviewed-by: Jonathan Nieder <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent ee6ad5f commit 9eaa78b

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

Makefile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1029,7 +1029,7 @@ ifdef HAVE_ALLOCA_H
10291029
endif
10301030

10311031
IMAP_SEND_BUILDDEPS =
1032-
IMAP_SEND_LDFLAGS = $(OPENSSL_LINK) $(OPENSSL_LIBSSL) $(LIB_4_CRYPTO)
1032+
IMAP_SEND_LDFLAGS =
10331033

10341034
ifdef NO_CURL
10351035
BASIC_CFLAGS += -DNO_CURL
@@ -1086,6 +1086,7 @@ else
10861086
endif
10871087
endif
10881088
endif
1089+
IMAP_SEND_LDFLAGS += $(OPENSSL_LINK) $(OPENSSL_LIBSSL) $(LIB_4_CRYPTO)
10891090

10901091
ifdef ZLIB_PATH
10911092
BASIC_CFLAGS += -I$(ZLIB_PATH)/include
@@ -1971,10 +1972,10 @@ git-imap-send$X: imap-send.o $(IMAP_SEND_BUILDDEPS) GIT-LDFLAGS $(GITLIBS)
19711972

19721973
git-http-fetch$X: http.o http-walker.o http-fetch.o GIT-LDFLAGS $(GITLIBS)
19731974
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
1974-
$(LIBS) $(CURL_LIBCURL)
1975+
$(CURL_LIBCURL) $(LIBS)
19751976
git-http-push$X: http.o http-push.o GIT-LDFLAGS $(GITLIBS)
19761977
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
1977-
$(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT)
1978+
$(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIBS)
19781979

19791980
git-remote-testsvn$X: remote-testsvn.o GIT-LDFLAGS $(GITLIBS) $(VCSSVN_LIB)
19801981
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS) \
@@ -1988,7 +1989,7 @@ $(REMOTE_CURL_ALIASES): $(REMOTE_CURL_PRIMARY)
19881989

19891990
$(REMOTE_CURL_PRIMARY): remote-curl.o http.o http-walker.o GIT-LDFLAGS $(GITLIBS)
19901991
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
1991-
$(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT)
1992+
$(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIBS)
19921993

19931994
$(LIB_FILE): $(LIB_OBJS)
19941995
$(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $^

0 commit comments

Comments
 (0)