diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2022-05-24 09:02:04 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2022-05-24 09:02:04 +0300 |
commit | 296e536be943ce6fa6194f61be42eef1254f1c06 (patch) | |
tree | a29c10e732a04c888f1c9d9071b0e9b8337a0c5a | |
parent | 94055b253d05bc04f533c977be892b0cd6f225ea (diff) |
Makefile: Fix compatibility with GNU Make v3.81
With GNU Make v3.82, the behaviour of pattern rules was changed.
Previously, pattern rules were applied in definition order, while with
that new version they're instead applied in shortest stem first order.
Quoting release notes:
The pattern-specific variables and pattern rules are now applied in the
shortest stem first order instead of the definition order (variables
and rules with the same stem length are still applied in the definition
order). This produces the usually-desired behavior where more specific
patterns are preferred. To detect this feature search for 'shortest-stem'
in the .FEATURES special variable.
With the introduction of the intermediate build directory we have
started to depend on the newer behaviour with shortest stem first, which
is breaking builds on macOS which installs GNU Make v3.81 by default.
Fix this issue by shifting around our build rules.
-rw-r--r-- | Makefile | 46 |
1 files changed, 23 insertions, 23 deletions
@@ -502,6 +502,29 @@ ${TOOLS_DIR}: | ${BUILD_DIR} ${DEPENDENCY_DIR}: | ${BUILD_DIR} ${Q}mkdir -p ${DEPENDENCY_DIR} +# 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. + @ # We cannot ever remove GIT_PREFIX though in case they're different + @ # because it may point to a user-controlled directory. + ${Q}if [ "x${GIT_DEFAULT_PREFIX}" = "x${GIT_PREFIX}" ]; then rm -rf "${GIT_DEFAULT_PREFIX}"; fi + ${Q}env -u PROFILE -u MAKEFLAGS -u GIT_VERSION ${MAKE} -C "$(<D)" -j$(shell nproc) prefix=${GIT_PREFIX} ${GIT_BUILD_OPTIONS} install + ${Q}touch $@ + +${BUILD_DIR}/bin/gitaly-%-v2.35.1.gl1: override GIT_PATCHES := $(sort $(wildcard ${SOURCE_DIR}/_support/git-patches/v2.35.1.gl1/*)) +${BUILD_DIR}/bin/gitaly-%-v2.35.1.gl1: override GIT_VERSION = v2.35.1 +${BUILD_DIR}/bin/gitaly-%-v2.35.1.gl1: override GIT_EXTRA_VERSION = gl1 +${BUILD_DIR}/bin/gitaly-%-v2.35.1.gl1: ${DEPENDENCY_DIR}/git-v2.35.1.gl1/% | ${BUILD_DIR}/bin + ${Q}install $< $@ + +${BUILD_DIR}/bin/gitaly-%-v2.36.1.gl1: override GIT_PATCHES := $(sort $(wildcard ${SOURCE_DIR}/_support/git-patches/v2.36.1.gl1/*)) +${BUILD_DIR}/bin/gitaly-%-v2.36.1.gl1: override GIT_VERSION = v2.36.1 +${BUILD_DIR}/bin/gitaly-%-v2.36.1.gl1: override GIT_EXTRA_VERSION = gl1 +${BUILD_DIR}/bin/gitaly-%-v2.36.1.gl1: ${DEPENDENCY_DIR}/git-v2.36.1.gl1/% | ${BUILD_DIR}/bin + ${Q}install $< $@ + ${BUILD_DIR}/bin/%: ${BUILD_DIR}/intermediate/% | ${BUILD_DIR}/bin @ # To compute a unique and deterministic value for GNU build-id, we use an @ # intermediate binary which has a fixed build ID of "TEMP_GITALY_BUILD_ID", @@ -590,29 +613,6 @@ $(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 $@ -# 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. - @ # We cannot ever remove GIT_PREFIX though in case they're different - @ # because it may point to a user-controlled directory. - ${Q}if [ "x${GIT_DEFAULT_PREFIX}" = "x${GIT_PREFIX}" ]; then rm -rf "${GIT_DEFAULT_PREFIX}"; fi - ${Q}env -u PROFILE -u MAKEFLAGS -u GIT_VERSION ${MAKE} -C "$(<D)" -j$(shell nproc) prefix=${GIT_PREFIX} ${GIT_BUILD_OPTIONS} install - ${Q}touch $@ - -${BUILD_DIR}/bin/gitaly-%-v2.35.1.gl1: override GIT_PATCHES := $(sort $(wildcard ${SOURCE_DIR}/_support/git-patches/v2.35.1.gl1/*)) -${BUILD_DIR}/bin/gitaly-%-v2.35.1.gl1: override GIT_VERSION = v2.35.1 -${BUILD_DIR}/bin/gitaly-%-v2.35.1.gl1: override GIT_EXTRA_VERSION = gl1 -${BUILD_DIR}/bin/gitaly-%-v2.35.1.gl1: ${DEPENDENCY_DIR}/git-v2.35.1.gl1/% | ${BUILD_DIR}/bin - ${Q}install $< $@ - -${BUILD_DIR}/bin/gitaly-%-v2.36.1.gl1: override GIT_PATCHES := $(sort $(wildcard ${SOURCE_DIR}/_support/git-patches/v2.36.1.gl1/*)) -${BUILD_DIR}/bin/gitaly-%-v2.36.1.gl1: override GIT_VERSION = v2.36.1 -${BUILD_DIR}/bin/gitaly-%-v2.36.1.gl1: override GIT_EXTRA_VERSION = gl1 -${BUILD_DIR}/bin/gitaly-%-v2.36.1.gl1: ${DEPENDENCY_DIR}/git-v2.36.1.gl1/% | ${BUILD_DIR}/bin - ${Q}install $< $@ - ${INSTALL_DEST_DIR}/gitaly-%: ${BUILD_DIR}/bin/gitaly-% ${Q}mkdir -p ${@D} ${Q}install $< $@ |