* [PATCH] Makefile: Track changes to LDFLAGS and relink when necessary
@ 2011-06-21 18:58 Fredrik Kuivinen
2011-06-22 8:51 ` Sverre Rabbelier
0 siblings, 1 reply; 3+ messages in thread
From: Fredrik Kuivinen @ 2011-06-21 18:58 UTC (permalink / raw
To: git; +Cc: Fredrik Kuivinen
Signed-off-by: Fredrik Kuivinen <frekui@gmail.com>
---
.gitignore | 1 +
Makefile | 25 +++++++++++++++++--------
2 files changed, 18 insertions(+), 8 deletions(-)
diff --git a/.gitignore b/.gitignore
index acffdfa..8572c8c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,6 @@
/GIT-BUILD-OPTIONS
/GIT-CFLAGS
+/GIT-LDFLAGS
/GIT-GUI-VARS
/GIT-VERSION-FILE
/bin-wrappers/
diff --git a/Makefile b/Makefile
index e40ac0c..75b407c 100644
--- a/Makefile
+++ b/Makefile
@@ -1706,7 +1706,7 @@ git.sp git.s git.o: EXTRA_CPPFLAGS = -DGIT_VERSION='"$(GIT_VERSION)"' \
'-DGIT_MAN_PATH="$(mandir_SQ)"' \
'-DGIT_INFO_PATH="$(infodir_SQ)"'
-git$X: git.o $(BUILTIN_OBJS) $(GITLIBS)
+git$X: git.o GIT-LDFLAGS $(BUILTIN_OBJS) $(GITLIBS)
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ git.o \
$(BUILTIN_OBJS) $(ALL_LDFLAGS) $(LIBS)
@@ -2004,17 +2004,17 @@ compat/nedmalloc/nedmalloc.sp compat/nedmalloc/nedmalloc.o: EXTRA_CPPFLAGS = \
-DNDEBUG -DOVERRIDE_STRDUP -DREPLACE_SYSTEM_ALLOCATOR
endif
-git-%$X: %.o $(GITLIBS)
+git-%$X: %.o GIT-LDFLAGS $(GITLIBS)
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)
-git-imap-send$X: imap-send.o $(GITLIBS)
+git-imap-send$X: imap-send.o GIT-LDFLAGS $(GITLIBS)
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
$(LIBS) $(OPENSSL_LINK) $(OPENSSL_LIBSSL) $(LIB_4_CRYPTO)
-git-http-fetch$X: revision.o http.o http-walker.o http-fetch.o $(GITLIBS)
+git-http-fetch$X: revision.o http.o http-walker.o http-fetch.o GIT-LDFLAGS $(GITLIBS)
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
$(LIBS) $(CURL_LIBCURL)
-git-http-push$X: revision.o http.o http-push.o $(GITLIBS)
+git-http-push$X: revision.o http.o http-push.o GIT-LDFLAGS $(GITLIBS)
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
$(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT)
@@ -2024,7 +2024,7 @@ $(REMOTE_CURL_ALIASES): $(REMOTE_CURL_PRIMARY)
ln -s $< $@ 2>/dev/null || \
cp $< $@
-$(REMOTE_CURL_PRIMARY): remote-curl.o http.o http-walker.o $(GITLIBS)
+$(REMOTE_CURL_PRIMARY): remote-curl.o http.o http-walker.o GIT-LDFLAGS $(GITLIBS)
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
$(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT)
@@ -2094,6 +2094,15 @@ GIT-CFLAGS: FORCE
echo "$$FLAGS" >GIT-CFLAGS; \
fi
+TRACK_LDFLAGS = $(subst ','\'',$(ALL_LDFLAGS))
+
+GIT-LDFLAGS: FORCE
+ @FLAGS='$(TRACK_LDFLAGS)'; \
+ if test x"$$FLAGS" != x"`cat GIT-LDFLAGS 2>/dev/null`" ; then \
+ echo 1>&2 " * new link flags"; \
+ echo "$$FLAGS" >GIT-LDFLAGS; \
+ fi
+
# We need to apply sq twice, once to protect from the shell
# that runs GIT-BUILD-OPTIONS, and then again to protect it
# and the first level quoting from the shell that runs "echo".
@@ -2165,7 +2174,7 @@ test-svn-fe$X: vcs-svn/lib.a
.PRECIOUS: $(TEST_OBJS)
-test-%$X: test-%.o $(GITLIBS)
+test-%$X: test-%.o GIT-LDFLAGS $(GITLIBS)
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(filter %.a,$^) $(LIBS)
check-sha1:: test-sha1$X
@@ -2375,7 +2384,7 @@ ifndef NO_TCLTK
$(MAKE) -C gitk-git clean
$(MAKE) -C git-gui clean
endif
- $(RM) GIT-VERSION-FILE GIT-CFLAGS GIT-GUI-VARS GIT-BUILD-OPTIONS
+ $(RM) GIT-VERSION-FILE GIT-CFLAGS GIT-LDFLAGS GIT-GUI-VARS GIT-BUILD-OPTIONS
.PHONY: all install clean strip
.PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell
--
1.7.5.3.368.g8b1b7.dirty
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] Makefile: Track changes to LDFLAGS and relink when necessary
2011-06-21 18:58 [PATCH] Makefile: Track changes to LDFLAGS and relink when necessary Fredrik Kuivinen
@ 2011-06-22 8:51 ` Sverre Rabbelier
2011-06-22 10:44 ` Fredrik Kuivinen
0 siblings, 1 reply; 3+ messages in thread
From: Sverre Rabbelier @ 2011-06-22 8:51 UTC (permalink / raw
To: Fredrik Kuivinen; +Cc: git
Heya,
On Tue, Jun 21, 2011 at 20:58, Fredrik Kuivinen <frekui@gmail.com> wrote:
It might be interesting to note in the commit message why this change
is made (now), and if there are any other similar flags that we ought
to track.
--
Cheers,
Sverre Rabbelier
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Makefile: Track changes to LDFLAGS and relink when necessary
2011-06-22 8:51 ` Sverre Rabbelier
@ 2011-06-22 10:44 ` Fredrik Kuivinen
0 siblings, 0 replies; 3+ messages in thread
From: Fredrik Kuivinen @ 2011-06-22 10:44 UTC (permalink / raw
To: Sverre Rabbelier; +Cc: git
On Wed, Jun 22, 2011 at 10:51, Sverre Rabbelier <srabbelier@gmail.com> wrote:
> Heya,
>
> On Tue, Jun 21, 2011 at 20:58, Fredrik Kuivinen <frekui@gmail.com> wrote:
>
> It might be interesting to note in the commit message why this change
> is made (now), and if there are any other similar flags that we ought
> to track.
I agree, will send an updated patch in a minute. I don't know why the
change hasn't been done before. Maybe people don't change LDFLAGS
that often so it has simply been no need for the change.
- Fredrik
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-06-22 10:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-21 18:58 [PATCH] Makefile: Track changes to LDFLAGS and relink when necessary Fredrik Kuivinen
2011-06-22 8:51 ` Sverre Rabbelier
2011-06-22 10:44 ` Fredrik Kuivinen
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).