In preceding commits we fixed that build info set via e.g. `make GIT_VERSION=foo` didn't get propagated to GIT-VERSION-GEN. Similarly though, setting build info via "config.mak" does not work anymore either because the variables are only declared as Makefile variables and thus aren't accessible by the script. Fix the issue by exporting those variables via "shared.mak". This also allows us to deduplicate the export of GIT_USER_AGENT. Suggested-by: Jeff King <peff@xxxxxxxx> Signed-off-by: Patrick Steinhardt <ps@xxxxxx> --- Documentation/Makefile | 4 ++-- Makefile | 2 +- shared.mak | 7 +++++++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Documentation/Makefile b/Documentation/Makefile index cee88dbda66265141b87d5e5c16bf86df22fa4ef..4c652dfa14f6af2c1374e2f83d3311b36dd297c4 100644 --- a/Documentation/Makefile +++ b/Documentation/Makefile @@ -211,10 +211,10 @@ XMLTO_EXTRA += --skip-validation XMLTO_EXTRA += -x manpage.xsl asciidoctor-extensions.rb: asciidoctor-extensions.rb.in FORCE - $(QUIET_GEN)GIT_USER_AGENT="$(GIT_USER_AGENT)" $(SHELL_PATH) ../GIT-VERSION-GEN "$(shell pwd)/.." $< $@ + $(QUIET_GEN)$(SHELL_PATH) ../GIT-VERSION-GEN "$(shell pwd)/.." $< $@ else asciidoc.conf: asciidoc.conf.in FORCE - $(QUIET_GEN)GIT_USER_AGENT="$(GIT_USER_AGENT)" $(SHELL_PATH) ../GIT-VERSION-GEN "$(shell pwd)/.." $< $@ + $(QUIET_GEN)$(SHELL_PATH) ../GIT-VERSION-GEN "$(shell pwd)/.." $< $@ endif ASCIIDOC_DEPS += docinfo.html diff --git a/Makefile b/Makefile index 695a9d9765daf864605002d572129bae7a8c4e40..788f6ee1721850e75f19fe2181f578ad2e783043 100644 --- a/Makefile +++ b/Makefile @@ -2512,7 +2512,7 @@ pager.sp pager.s pager.o: EXTRA_CPPFLAGS = \ -DPAGER_ENV='$(PAGER_ENV_CQ_SQ)' version-def.h: version-def.h.in GIT-VERSION-GEN GIT-VERSION-FILE GIT-USER-AGENT - $(QUIET_GEN)GIT_USER_AGENT="$(GIT_USER_AGENT)" $(SHELL_PATH) ./GIT-VERSION-GEN "$(shell pwd)" $< $@ + $(QUIET_GEN)$(SHELL_PATH) ./GIT-VERSION-GEN "$(shell pwd)" $< $@ version.sp version.s version.o: version-def.h diff --git a/shared.mak b/shared.mak index 29bebd30d8acbce9f50661cef48ecdbae1e41f5a..8cd132b5a03b85d4eabc3819eb3d1f64d39afa47 100644 --- a/shared.mak +++ b/shared.mak @@ -116,3 +116,10 @@ endef define libpath_template -L$(1) $(if $(filter-out -L,$(CC_LD_DYNPATH)),$(CC_LD_DYNPATH)$(1)) endef + +# Export build information so that variables defined in config.mak can be read +# by GIT-VERSION-GEN. +export GIT_BUILT_FROM_COMMIT +export GIT_DATE +export GIT_USER_AGENT +export GIT_VERSION -- 2.48.0.rc0.184.g0fc57dec57.dirty