aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2012-06-20 14:31:51 -0400
committerJunio C Hamano <gitster@pobox.com>2012-07-09 07:57:29 -0700
commit620c293abdc36f3db18edd61a622eae30f01ce8e (patch)
treec43dbc02a81dbfcf01597e152d94c9fc20dc62bd
parent47eb28ec0cdb372f4354800e2e0ec713ad4c1992 (diff)
downloadgit-620c293abdc36f3db18edd61a622eae30f01ce8e.tar.gz
git-620c293abdc36f3db18edd61a622eae30f01ce8e.tar.xz
Makefile: split GIT_USER_AGENT from GIT-CFLAGS
The default user-agent depends on the GIT_VERSION, which means that anytime you switch versions, it causes a full rebuild. Instead, let's split it out into its own file and restrict the dependency to version.o. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--.gitignore1
-rw-r--r--Makefile11
2 files changed, 10 insertions, 2 deletions
diff --git a/.gitignore b/.gitignore
index bf66648e2..7329cfe5c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,6 +2,7 @@
/GIT-CFLAGS
/GIT-LDFLAGS
/GIT-GUI-VARS
+/GIT-USER-AGENT
/GIT-VERSION-FILE
/bin-wrappers/
/git
diff --git a/Makefile b/Makefile
index d41231529..2037caa61 100644
--- a/Makefile
+++ b/Makefile
@@ -1922,7 +1922,11 @@ endif
GIT_USER_AGENT_SQ = $(subst ','\'',$(GIT_USER_AGENT))
GIT_USER_AGENT_CQ = "$(subst ",\",$(subst \,\\,$(GIT_USER_AGENT)))"
GIT_USER_AGENT_CQ_SQ = $(subst ','\'',$(GIT_USER_AGENT_CQ))
-BASIC_CFLAGS += -DGIT_USER_AGENT='$(GIT_USER_AGENT_CQ_SQ)'
+GIT-USER-AGENT: FORCE
+ @if test x'$(GIT_USER_AGENT_SQ)' != x"`cat GIT-USER-AGENT 2>/dev/null`"; then \
+ echo >&2 " * new user-agent flag"; \
+ echo '$(GIT_USER_AGENT_SQ)' >GIT-USER-AGENT; \
+ fi
ALL_CFLAGS += $(BASIC_CFLAGS)
ALL_LDFLAGS += $(BASIC_LDFLAGS)
@@ -1987,8 +1991,10 @@ builtin/help.sp builtin/help.s builtin/help.o: EXTRA_CPPFLAGS = \
'-DGIT_MAN_PATH="$(mandir_SQ)"' \
'-DGIT_INFO_PATH="$(infodir_SQ)"'
+version.sp version.s version.o: GIT-USER-AGENT
version.sp version.s version.o: EXTRA_CPPFLAGS = \
- '-DGIT_VERSION="$(GIT_VERSION)"'
+ '-DGIT_VERSION="$(GIT_VERSION)"' \
+ '-DGIT_USER_AGENT=$(GIT_USER_AGENT_CQ_SQ)'
$(BUILT_INS): git$X
$(QUIET_BUILT_IN)$(RM) $@ && \
@@ -2710,6 +2716,7 @@ ifndef NO_TCLTK
$(MAKE) -C git-gui clean
endif
$(RM) GIT-VERSION-FILE GIT-CFLAGS GIT-LDFLAGS GIT-GUI-VARS GIT-BUILD-OPTIONS
+ $(RM) GIT-USER-AGENT
.PHONY: all install profile-clean clean strip
.PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell