]> git.ipfire.org Git - thirdparty/git.git/commit
Makefile: refactor GIT-VERSION-GEN to be reusable
authorPatrick Steinhardt <ps@pks.im>
Fri, 6 Dec 2024 13:24:38 +0000 (14:24 +0100)
committerJunio C Hamano <gitster@pobox.com>
Fri, 6 Dec 2024 22:52:08 +0000 (07:52 +0900)
commit4838deab65e71686353ad2e40cad679e26bfc0a4
treecc6eb27793d1f030da0386fc38c5ef45c9e5e24e
parentdbe46c0feb25417d01267bb97edb861694ed023d
Makefile: refactor GIT-VERSION-GEN to be reusable

Our "GIT-VERSION-GEN" script always writes the "GIT-VERSION-FILE" into
the current directory, where the expectation is that it should exist in
the source directory. But other build systems that support out-of-tree
builds may not want to do that to keep the source directory pristine,
even though CMake currently doesn't care.

Refactor the script such that it won't write the "GIT-VERSION-FILE"
directly anymore, but instead knows to replace @PLACEHOLDERS@ in an
arbitrary input file. This allows us to simplify the logic in CMake to
determine the project version, but can also be reused later on in order
to generate other files that need to contain version information like
our "git.rc" file.

While at it, change the format of the version file by removing the
spaces around the equals sign. Like this we can continue to include the
file in our Makefiles, but can also start to source it in shell scripts
in subsequent steps.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
GIT-VERSION-FILE.in [new file with mode: 0644]
GIT-VERSION-GEN
Makefile
ci/test-documentation.sh
contrib/buildsystems/CMakeLists.txt
contrib/buildsystems/git-version.in [new file with mode: 0644]