{"thread":{"id":"27676","subject":"[PATCH] Makefile: Track changes to LDFLAGS and relink when necessary","startedAt":"2011-06-21T18:58:46Z","lastAt":"2011-06-22T10:44:05Z","messageCount":3,"participants":["Fredrik Kuivinen","Sverre Rabbelier"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"170410","messageId":"1308682726-20971-1-git-send-email-frekui@gmail.com","threadId":"27676","inReplyTo":null,"subject":"[PATCH] Makefile: Track changes to LDFLAGS and relink when necessary","fromName":"Fredrik Kuivinen","fromEmail":"frekui@gmail.com","sentAt":"2011-06-21T18:58:46Z","receivedAt":"2011-06-21T18:58:46Z","isPatch":true,"sender":{"key":"frekui@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13770967?v=4"},"body":"\nSigned-off-by: Fredrik Kuivinen <frekui@gmail.com>\n---\n .gitignore |    1 +\n Makefile   |   25 +++++++++++++++++--------\n 2 files changed, 18 insertions(+), 8 deletions(-)\n\ndiff --git a/.gitignore b/.gitignore\nindex acffdfa..8572c8c 100644\n--- a/.gitignore\n+++ b/.gitignore\n@@ -1,5 +1,6 @@\n /GIT-BUILD-OPTIONS\n /GIT-CFLAGS\n+/GIT-LDFLAGS\n /GIT-GUI-VARS\n /GIT-VERSION-FILE\n /bin-wrappers/\ndiff --git a/Makefile b/Makefile\nindex e40ac0c..75b407c 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -1706,7 +1706,7 @@ git.sp git.s git.o: EXTRA_CPPFLAGS = -DGIT_VERSION='\"$(GIT_VERSION)\"' \\\n \t'-DGIT_MAN_PATH=\"$(mandir_SQ)\"' \\\n \t'-DGIT_INFO_PATH=\"$(infodir_SQ)\"'\n \n-git$X: git.o $(BUILTIN_OBJS) $(GITLIBS)\n+git$X: git.o GIT-LDFLAGS $(BUILTIN_OBJS) $(GITLIBS)\n \t$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ git.o \\\n \t\t$(BUILTIN_OBJS) $(ALL_LDFLAGS) $(LIBS)\n \n@@ -2004,17 +2004,17 @@ compat/nedmalloc/nedmalloc.sp compat/nedmalloc/nedmalloc.o: EXTRA_CPPFLAGS = \\\n \t-DNDEBUG -DOVERRIDE_STRDUP -DREPLACE_SYSTEM_ALLOCATOR\n endif\n \n-git-%$X: %.o $(GITLIBS)\n+git-%$X: %.o GIT-LDFLAGS $(GITLIBS)\n \t$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)\n \n-git-imap-send$X: imap-send.o $(GITLIBS)\n+git-imap-send$X: imap-send.o GIT-LDFLAGS $(GITLIBS)\n \t$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \\\n \t\t$(LIBS) $(OPENSSL_LINK) $(OPENSSL_LIBSSL) $(LIB_4_CRYPTO)\n \n-git-http-fetch$X: revision.o http.o http-walker.o http-fetch.o $(GITLIBS)\n+git-http-fetch$X: revision.o http.o http-walker.o http-fetch.o GIT-LDFLAGS $(GITLIBS)\n \t$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \\\n \t\t$(LIBS) $(CURL_LIBCURL)\n-git-http-push$X: revision.o http.o http-push.o $(GITLIBS)\n+git-http-push$X: revision.o http.o http-push.o GIT-LDFLAGS $(GITLIBS)\n \t$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \\\n \t\t$(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT)\n \n@@ -2024,7 +2024,7 @@ $(REMOTE_CURL_ALIASES): $(REMOTE_CURL_PRIMARY)\n \tln -s $< $@ 2>/dev/null || \\\n \tcp $< $@\n \n-$(REMOTE_CURL_PRIMARY): remote-curl.o http.o http-walker.o $(GITLIBS)\n+$(REMOTE_CURL_PRIMARY): remote-curl.o http.o http-walker.o GIT-LDFLAGS $(GITLIBS)\n \t$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \\\n \t\t$(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT)\n \n@@ -2094,6 +2094,15 @@ GIT-CFLAGS: FORCE\n \t\techo \"$$FLAGS\" >GIT-CFLAGS; \\\n             fi\n \n+TRACK_LDFLAGS = $(subst ','\\'',$(ALL_LDFLAGS))\n+\n+GIT-LDFLAGS: FORCE\n+\t@FLAGS='$(TRACK_LDFLAGS)'; \\\n+\t    if test x\"$$FLAGS\" != x\"`cat GIT-LDFLAGS 2>/dev/null`\" ; then \\\n+\t\techo 1>&2 \"    * new link flags\"; \\\n+\t\techo \"$$FLAGS\" >GIT-LDFLAGS; \\\n+            fi\n+\n # We need to apply sq twice, once to protect from the shell\n # that runs GIT-BUILD-OPTIONS, and then again to protect it\n # and the first level quoting from the shell that runs \"echo\".\n@@ -2165,7 +2174,7 @@ test-svn-fe$X: vcs-svn/lib.a\n \n .PRECIOUS: $(TEST_OBJS)\n \n-test-%$X: test-%.o $(GITLIBS)\n+test-%$X: test-%.o GIT-LDFLAGS $(GITLIBS)\n \t$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(filter %.a,$^) $(LIBS)\n \n check-sha1:: test-sha1$X\n@@ -2375,7 +2384,7 @@ ifndef NO_TCLTK\n \t$(MAKE) -C gitk-git clean\n \t$(MAKE) -C git-gui clean\n endif\n-\t$(RM) GIT-VERSION-FILE GIT-CFLAGS GIT-GUI-VARS GIT-BUILD-OPTIONS\n+\t$(RM) GIT-VERSION-FILE GIT-CFLAGS GIT-LDFLAGS GIT-GUI-VARS GIT-BUILD-OPTIONS\n \n .PHONY: all install clean strip\n .PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell\n-- \n1.7.5.3.368.g8b1b7.dirty\n"},{"id":"170453","messageId":"BANLkTi=XOEFyVu-ZEqpmLaD60FL6dV2ndA@mail.gmail.com","threadId":"27676","inReplyTo":"1308682726-20971-1-git-send-email-frekui@gmail.com","subject":"Re: [PATCH] Makefile: Track changes to LDFLAGS and relink when necessary","fromName":"Sverre Rabbelier","fromEmail":"srabbelier@gmail.com","sentAt":"2011-06-22T08:51:35Z","receivedAt":"2011-06-22T08:51:35Z","isPatch":true,"sender":{"key":"srabbelier@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3098?v=4"},"body":"Heya,\n\nOn Tue, Jun 21, 2011 at 20:58, Fredrik Kuivinen <frekui@gmail.com> wrote:\n\nIt might be interesting to note in the commit message why this change\nis made (now), and if there are any other similar flags that we ought\nto track.\n\n-- \nCheers,\n\nSverre Rabbelier\n"},{"id":"170458","messageId":"BANLkTi=4Pj0bLswUNLXebkVOqLOiq2eNoA@mail.gmail.com","threadId":"27676","inReplyTo":"BANLkTi=XOEFyVu-ZEqpmLaD60FL6dV2ndA@mail.gmail.com","subject":"Re: [PATCH] Makefile: Track changes to LDFLAGS and relink when necessary","fromName":"Fredrik Kuivinen","fromEmail":"frekui@gmail.com","sentAt":"2011-06-22T10:44:05Z","receivedAt":"2011-06-22T10:44:05Z","isPatch":true,"sender":{"key":"frekui@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13770967?v=4"},"body":"On Wed, Jun 22, 2011 at 10:51, Sverre Rabbelier <srabbelier@gmail.com> wrote:\n> Heya,\n>\n> On Tue, Jun 21, 2011 at 20:58, Fredrik Kuivinen <frekui@gmail.com> wrote:\n>\n> It might be interesting to note in the commit message why this change\n> is made (now), and if there are any other similar flags that we ought\n> to track.\n\nI agree, will send an updated patch in a minute. I don't know why the\nchange hasn't been done before. Maybe people don't change LDFLAGS\nthat often so it has simply been no need for the change.\n\n\n- Fredrik\n"}]}