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:

committed by
Junio C Hamano

parent
b329f2eb00
commit
114494ae2c
@ -211,10 +211,10 @@ XMLTO_EXTRA += --skip-validation
|
|||||||
XMLTO_EXTRA += -x manpage.xsl
|
XMLTO_EXTRA += -x manpage.xsl
|
||||||
|
|
||||||
asciidoctor-extensions.rb: asciidoctor-extensions.rb.in FORCE
|
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)$(call version_gen,"$(shell pwd)/..",$<,$@)
|
||||||
else
|
else
|
||||||
asciidoc.conf: asciidoc.conf.in FORCE
|
asciidoc.conf: asciidoc.conf.in FORCE
|
||||||
$(QUIET_GEN)GIT_USER_AGENT="$(GIT_USER_AGENT)" $(SHELL_PATH) ../GIT-VERSION-GEN "$(shell pwd)/.." $< $@
|
$(QUIET_GEN)$(call version_gen,"$(shell pwd)/..",$<,$@)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ASCIIDOC_DEPS += docinfo.html
|
ASCIIDOC_DEPS += docinfo.html
|
||||||
|
6
Makefile
6
Makefile
@ -593,7 +593,7 @@ include shared.mak
|
|||||||
|
|
||||||
GIT-VERSION-FILE: FORCE
|
GIT-VERSION-FILE: FORCE
|
||||||
@OLD=$$(cat $@ 2>/dev/null || :) && \
|
@OLD=$$(cat $@ 2>/dev/null || :) && \
|
||||||
$(SHELL_PATH) ./GIT-VERSION-GEN "$(shell pwd)" GIT-VERSION-FILE.in $@ && \
|
$(call version_gen,"$(shell pwd)",GIT-VERSION-FILE.in,$@) && \
|
||||||
NEW=$$(cat $@ 2>/dev/null || :) && \
|
NEW=$$(cat $@ 2>/dev/null || :) && \
|
||||||
if test "$$OLD" != "$$NEW"; then echo "$$NEW" >&2; fi
|
if test "$$OLD" != "$$NEW"; then echo "$$NEW" >&2; fi
|
||||||
-include GIT-VERSION-FILE
|
-include GIT-VERSION-FILE
|
||||||
@ -2509,7 +2509,7 @@ pager.sp pager.s pager.o: EXTRA_CPPFLAGS = \
|
|||||||
-DPAGER_ENV='$(PAGER_ENV_CQ_SQ)'
|
-DPAGER_ENV='$(PAGER_ENV_CQ_SQ)'
|
||||||
|
|
||||||
version-def.h: version-def.h.in GIT-VERSION-GEN GIT-VERSION-FILE GIT-USER-AGENT
|
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)$(call version_gen,"$(shell pwd)",$<,$@)
|
||||||
|
|
||||||
version.sp version.s version.o: version-def.h
|
version.sp version.s version.o: version-def.h
|
||||||
|
|
||||||
@ -2550,7 +2550,7 @@ $(SCRIPT_SH_GEN) $(SCRIPT_LIB) : % : %.sh generate-script.sh GIT-BUILD-OPTIONS G
|
|||||||
mv $@+ $@
|
mv $@+ $@
|
||||||
|
|
||||||
git.rc: git.rc.in GIT-VERSION-GEN GIT-VERSION-FILE
|
git.rc: git.rc.in GIT-VERSION-GEN GIT-VERSION-FILE
|
||||||
$(QUIET_GEN)$(SHELL_PATH) ./GIT-VERSION-GEN "$(shell pwd)" $< $@
|
$(QUIET_GEN)$(call version_gen,"$(shell pwd)",$<,$@)
|
||||||
|
|
||||||
git.res: git.rc GIT-PREFIX
|
git.res: git.rc GIT-PREFIX
|
||||||
$(QUIET_RC)$(RC) -i $< -o $@
|
$(QUIET_RC)$(RC) -i $< -o $@
|
||||||
|
@ -116,3 +116,11 @@ endef
|
|||||||
define libpath_template
|
define libpath_template
|
||||||
-L$(1) $(if $(filter-out -L,$(CC_LD_DYNPATH)),$(CC_LD_DYNPATH)$(1))
|
-L$(1) $(if $(filter-out -L,$(CC_LD_DYNPATH)),$(CC_LD_DYNPATH)$(1))
|
||||||
endef
|
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
|
||||||
|
Reference in New Issue
Block a user