Makefile: introduce template for GIT-VERSION-GEN

Introduce a new template to call GIT-VERSION-GEN. This will allow us to
iterate on how exactly the script is called in subsequent commits
without having to adapt all call sites every time.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Patrick Steinhardt
2024-12-20 20:44:23 +01:00
committed by Junio C Hamano
parent b329f2eb00
commit 114494ae2c
3 changed files with 13 additions and 5 deletions

View File

@ -116,3 +116,11 @@ endef
define libpath_template
-L$(1) $(if $(filter-out -L,$(CC_LD_DYNPATH)),$(CC_LD_DYNPATH)$(1))
endef
# Populate build information into a file via GIT-VERSION-GEN. Requires the
# absolute path to the root source directory as well as input and output files
# as arguments, in that order.
define version_gen
GIT_USER_AGENT="$(GIT_USER_AGENT)" \
$(SHELL_PATH) "$(1)/GIT-VERSION-GEN" "$(1)" "$(2)" "$(3)"
endef