diff options
author | Toon Claes <toon@gitlab.com> | 2021-12-07 14:13:30 +0300 |
---|---|---|
committer | Toon Claes <toon@gitlab.com> | 2021-12-07 14:13:30 +0300 |
commit | e85ed7eeb612d15ef34c65ed3d7f955114a885b3 (patch) | |
tree | 2a0159b34a2b63c4cdbccabcdf47758d3842ee24 /Makefile | |
parent | 3ef55853e9e161204464868390d97d1a1577042d (diff) | |
parent | 755302945822f7caaf694f0b0b203aebc378d9af (diff) |
Merge branch 'pks-makefile-cleanups' into 'master'
Makefile: Random set of improvements
See merge request gitlab-org/gitaly!4158
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 19 |
1 files changed, 10 insertions, 9 deletions
@@ -44,7 +44,7 @@ INSTALL_DEST_DIR := ${DESTDIR}${bindir} GIT_PREFIX ?= ${GIT_DEFAULT_PREFIX} # Tools -GIT := $(shell which git) +GIT := $(shell command -v git) GOIMPORTS := ${TOOLS_DIR}/goimports GOFUMPT := ${TOOLS_DIR}/gofumpt GOLANGCI_LINT := ${TOOLS_DIR}/golangci-lint @@ -418,7 +418,7 @@ notice: ${SOURCE_DIR}/NOTICE .PHONY: clean ## Clean up build artifacts. clean: - rm -rf ${BUILD_DIR} ${SOURCE_DIR}/internal/testhelper/testdata/data/ ${SOURCE_DIR}/ruby/.bundle/ ${SOURCE_DIR}/ruby/vendor/bundle/ + rm -rf ${BUILD_DIR} ${SOURCE_DIR}/ruby/.bundle/ ${SOURCE_DIR}/ruby/vendor/bundle/ .PHONY: clean-ruby-vendor-go clean-ruby-vendor-go: @@ -586,11 +586,12 @@ ${GIT_SOURCE_DIR}/%: ${GIT_SOURCE_DIR}/Makefile ${Q}touch $@ ${GIT_PREFIX}/bin/git: ${GIT_SOURCE_DIR}/Makefile - # Note that we're deleting GIT_DEFAULT_PREFIX, not GIT_PREFIX: we only - # want to remove the default location in our build directory, but never - # want to delete the actual location the user wants to install to. - # Otherwise, we may end up wiping e.g. `/usr/local`. - ${Q}rm -rf ${GIT_DEFAULT_PREFIX} + # 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 ${GIT_SOURCE_DIR} -j$(shell nproc) prefix=${GIT_PREFIX} ${GIT_BUILD_OPTIONS} install ${Q}touch $@ @@ -637,14 +638,14 @@ ${TEST_REPO}: ${Q}rm -rf $@/refs ${Q}mkdir -p $@/refs/heads $@/refs/tags ${Q}cp ${SOURCE_DIR}/_support/gitlab-test.git-packed-refs $@/packed-refs - ${Q}${GIT} -C $@ fsck --no-progress + ${Q}${GIT} -C $@ fsck --no-progress --no-dangling ${TEST_REPO_GIT}: ${GIT} clone --bare ${GIT_QUIET} https://gitlab.com/gitlab-org/gitlab-git-test.git $@ ${Q}rm -rf $@/refs ${Q}mkdir -p $@/refs/heads $@/refs/tags ${Q}cp ${SOURCE_DIR}/_support/gitlab-git-test.git-packed-refs $@/packed-refs - ${Q}${GIT} -C $@ fsck --no-progress + ${Q}${GIT} -C $@ fsck --no-progress --no-dangling ${BENCHMARK_REPO}: ${GIT} clone --bare ${GIT_QUIET} https://gitlab.com/gitlab-org/gitlab.git $@ |