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 <repk@triplefau.lt> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Remi Pommarel committed Oct 21, 2015 at 19:01 UTC 9eaa78b0b037964da85d6a15f0128639f2118a53
1 file changed +5 -4
Makefile
+5 -4
@@ -1029,7 +1029,7 @@ ifdef HAVE_ALLOCA_H
1029 endif
1030
1031 IMAP_SEND_BUILDDEPS =
1032 -IMAP_SEND_LDFLAGS = $(OPENSSL_LINK) $(OPENSSL_LIBSSL) $(LIB_4_CRYPTO)
1032 +IMAP_SEND_LDFLAGS =
1033
1034 ifdef NO_CURL
1035 BASIC_CFLAGS += -DNO_CURL
@@ -1086,6 +1086,7 @@ else
1086 endif
1087 endif
1088 endif
1089 +IMAP_SEND_LDFLAGS += $(OPENSSL_LINK) $(OPENSSL_LIBSSL) $(LIB_4_CRYPTO)
1090
1091 ifdef ZLIB_PATH
1092 BASIC_CFLAGS += -I$(ZLIB_PATH)/include
@@ -1971,10 +1972,10 @@ git-imap-send$X: imap-send.o $(IMAP_SEND_BUILDDEPS) GIT-LDFLAGS $(GITLIBS)
1972
1973 git-http-fetch$X: http.o http-walker.o http-fetch.o GIT-LDFLAGS $(GITLIBS)
1974 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
1974 - $(LIBS) $(CURL_LIBCURL)
1975 + $(CURL_LIBCURL) $(LIBS)
1976 git-http-push$X: http.o http-push.o GIT-LDFLAGS $(GITLIBS)
1977 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
1977 - $(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT)
1978 + $(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIBS)
1979
1980 git-remote-testsvn$X: remote-testsvn.o GIT-LDFLAGS $(GITLIBS) $(VCSSVN_LIB)
1981 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS) \
@@ -1988,7 +1989,7 @@ $(REMOTE_CURL_ALIASES): $(REMOTE_CURL_PRIMARY)
1989
1990 $(REMOTE_CURL_PRIMARY): remote-curl.o http.o http-walker.o GIT-LDFLAGS $(GITLIBS)
1991 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
1991 - $(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT)
1992 + $(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIBS)
1993
1994 $(LIB_FILE): $(LIB_OBJS)
1995 $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $^