Skip to contentSkip to conversation

Makefile: limit specifying -DGIT_USER_AGENT=... to keep ccache efficient

PATCH In review Nguyễn Thái Ngọc Duy 1 participant 2 messages Jun 15, 2016 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Makefile: limit specifying -DGIT_USER_AGENT=... to keep ccache efficient

GIT_USER_AGENT changes as HEAD changes. Defining it in BASIC_FLAGS means every time HEAD changes, the compiling options for every object file is changed, which defeats the purpose of using ccache.

As version.c is the only file that uses this definition, limit defining only when compiling this file.

---
 Makefile |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
Makefile +2 -2
index f62ca2a..b3ce00d 100644
@@ -1929,7 +1929,6 @@ 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)'
 
 ifdef DEFAULT_HELP_FORMAT
 BASIC_CFLAGS += -DDEFAULT_HELP_FORMAT='"$(DEFAULT_HELP_FORMAT)"'
@@ -2000,7 +1999,8 @@ builtin/help.sp builtin/help.s builtin/help.o: EXTRA_CPPFLAGS = \
 	'-DGIT_INFO_PATH="$(infodir_SQ)"'
 
 version.sp version.s version.o: EXTRA_CPPFLAGS = \
-	'-DGIT_VERSION="$(GIT_VERSION)"'
+	'-DGIT_VERSION="$(GIT_VERSION)"' \
+	'-DGIT_USER_AGENT="$(GIT_USER_AGENT)"'
 
 $(BUILT_INS): git$X
 	$(QUIET_BUILT_IN)$(RM) $@ && \
Signature · 1 line
1.7.8
#1 lore raw
Quoted 6 lines · Nguyễn Thái Ngọc Duy

GIT_USER_AGENT changes as HEAD changes. Defining it in BASIC_FLAGS means every time HEAD changes, the compiling options for every object file is changed, which defeats the purpose of using ccache.

As version.c is the only file that uses this definition, limit defining only when compiling this file.

Uhm.. something like this is in jk/version-string-dependency already. Sorry for the noise.

Signature · 1 line
Duy