diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2022-04-27 15:28:30 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2022-04-27 15:40:12 +0300 |
commit | 3b432a163fb0676d8aa3d369c9c477c3d976d787 (patch) | |
tree | e12058e640f489c60362891dd498eca54a492a7f | |
parent | ccfab390f7c32dae9d5683662be62d27c80f768f (diff) |
Makefile: Fix rebuilding distributed Git when switching versions
Building either our full Git distribution or the bundled Git versions
always uses a `.version` file to verify whether we need to rebuild the
target or not: only if the commit, build options or patches have been
modified since the last time the `.version` file was generated will we
actually rebuild Git. This is an important optimization and works quite
well.
One case where it doesn't work well right now though is when building
different versions of distributed Git. Depending on which version the
user wants to build via `GIT_VERSION`, we use different directories to
build Git and thus also use different `.version` files. This has a catch
though: because the `.version` file will not be updated again when both
Git versions have already been built successfully, we now think that we
don't need to rebuild Git because its `Makefile` is still newer than the
`.version` file when we switch between versions.
Fix this bug by always using the same directory to build distributed
Git, regardless of its version. While this means more rebuilds, it's
simple and correct.
-rw-r--r-- | Makefile | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -557,7 +557,8 @@ $(patsubst %,${DEPENDENCY_DIR}/git-\%/%,${GIT_EXECUTABLES}): ${DEPENDENCY_DIR}/g ${Q}env -u PROFILE -u MAKEFLAGS -u GIT_VERSION ${MAKE} -C "${@D}" -j$(shell nproc) prefix=${GIT_PREFIX} ${GIT_BUILD_OPTIONS} ${GIT_EXECUTABLES} ${Q}touch $@ -${GIT_PREFIX}/bin/git: ${DEPENDENCY_DIR}/git-${GIT_VERSION}.${GIT_EXTRA_VERSION}/Makefile +# This target builds a full Git distribution and installs it into GIT_PREFIX. +${GIT_PREFIX}/bin/git: ${DEPENDENCY_DIR}/git-distribution/Makefile @ # Remove the Git installation first in case GIT_PREFIX is the default @ # prefix which always points into our build directory. This is done so @ # we never end up with mixed Git installations on developer machines. |