Makefile: propagate Git version via generated header

We set up a couple of preprocessor macros when compiling Git that
propagate the version that Git was built from to `git version` et al.
The way this is set up makes it harder than necessary to reuse the
infrastructure across the different build systems.

Refactor this such that we generate a "version-def.h" header via
`GIT-VERSION-GEN` instead.

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-06 14:24:39 +01:00
committed by Junio C Hamano
parent 4838deab65
commit 0c8d339514
6 changed files with 35 additions and 11 deletions

8
version-def.h.in Normal file
View File

@@ -0,0 +1,8 @@
#ifndef VERSION_DEF_H
#define VERSION_DEF_H
#define GIT_VERSION "@GIT_VERSION@"
#define GIT_BUILT_FROM_COMMIT "@GIT_BUILT_FROM_COMMIT@"
#define GIT_USER_AGENT "@GIT_USER_AGENT@"
#endif /* VERSION_DEF_H */