Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <psteinhardt@gitlab.com>2022-05-11 15:29:18 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2022-05-11 15:29:18 +0300
commit669b9d0d5c56744d8b5ff4092e5c03aee6d53061 (patch)
tree2336cf09dbdf46a515daf8c2b49e51a9f1dd7fed
parent4ca277d076aa7fae3aba0dcfd4ea3f6cca6faa87 (diff)
Makefile: Move recipes to build Go binaries
We have roughly three sections in our Makefile: 1. The section declaring all variables and build options. 2. The section declaring phony targets like `build` and `install`. 3. The section declaring actual recipes to generate the artifacts. While we mostly abide by these sections, the recipes to build our Go binaries are intermixed into the phony-targets-section. Move them down so that they're together with all the other recipes.
-rw-r--r--Makefile46
1 files changed, 23 insertions, 23 deletions
diff --git a/Makefile b/Makefile
index 75a8dd935..494a66d7d 100644
--- a/Makefile
+++ b/Makefile
@@ -283,29 +283,6 @@ help:
## Build Go binaries and install required Ruby Gems.
build: ${SOURCE_DIR}/.ruby-bundle ${GITALY_EXECUTABLES}
-${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",
- @ # which we replace with a deterministic build ID derived from the Go build ID.
- @ # If we cannot extract a Go build-id, we punt and fallback to using a random 32-byte hex string.
- @ # This fallback is unique but non-deterministic, making it sufficient to avoid generating the
- @ # GNU build-id from the empty string and causing guaranteed collisions.
- ${Q}GO_BUILD_ID=$$(go tool buildid "$<" || openssl rand -hex 32) && \
- GNU_BUILD_ID=$$(echo $$GO_BUILD_ID | sha1sum | cut -d' ' -f1) && \
- go run "${SOURCE_DIR}"/tools/replace-buildid \
- -input "$<" -input-build-id "${TEMPORARY_BUILD_ID}" \
- -output "$@" -output-build-id "$$GNU_BUILD_ID"
-
-${BUILD_DIR}/intermediate/gitaly: GO_BUILD_TAGS = ${SERVER_BUILD_TAGS}
-${BUILD_DIR}/intermediate/praefect: GO_BUILD_TAGS = ${SERVER_BUILD_TAGS}
-${BUILD_DIR}/intermediate/gitaly-git2go-v14: GO_BUILD_TAGS = ${GIT2GO_BUILD_TAGS}
-${BUILD_DIR}/intermediate/gitaly-git2go-v14: libgit2
-${BUILD_DIR}/intermediate/%: .FORCE
- @ # We're building intermediate binaries first which contain a fixed build ID
- @ # of "TEMP_GITALY_BUILD_ID". In the final binary we replace this build ID with
- @ # the computed build ID for this binary.
- ${Q}go build -o "$@" -ldflags '-B 0x${TEMPORARY_BUILD_ID} ${GO_LDFLAGS}' -tags "${GO_BUILD_TAGS}" $(addprefix ${SOURCE_DIR}/cmd/,$(@F))
-
.PHONY: install
## Install Gitaly binaries. The target directory can be modified by setting PREFIX and DESTDIR.
install: build
@@ -525,6 +502,29 @@ ${TOOLS_DIR}: | ${BUILD_DIR}
${DEPENDENCY_DIR}: | ${BUILD_DIR}
${Q}mkdir -p ${DEPENDENCY_DIR}
+${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",
+ @ # which we replace with a deterministic build ID derived from the Go build ID.
+ @ # If we cannot extract a Go build-id, we punt and fallback to using a random 32-byte hex string.
+ @ # This fallback is unique but non-deterministic, making it sufficient to avoid generating the
+ @ # GNU build-id from the empty string and causing guaranteed collisions.
+ ${Q}GO_BUILD_ID=$$(go tool buildid "$<" || openssl rand -hex 32) && \
+ GNU_BUILD_ID=$$(echo $$GO_BUILD_ID | sha1sum | cut -d' ' -f1) && \
+ go run "${SOURCE_DIR}"/tools/replace-buildid \
+ -input "$<" -input-build-id "${TEMPORARY_BUILD_ID}" \
+ -output "$@" -output-build-id "$$GNU_BUILD_ID"
+
+${BUILD_DIR}/intermediate/gitaly: GO_BUILD_TAGS = ${SERVER_BUILD_TAGS}
+${BUILD_DIR}/intermediate/praefect: GO_BUILD_TAGS = ${SERVER_BUILD_TAGS}
+${BUILD_DIR}/intermediate/gitaly-git2go-v14: GO_BUILD_TAGS = ${GIT2GO_BUILD_TAGS}
+${BUILD_DIR}/intermediate/gitaly-git2go-v14: libgit2
+${BUILD_DIR}/intermediate/%: .FORCE
+ @ # We're building intermediate binaries first which contain a fixed build ID
+ @ # of "TEMP_GITALY_BUILD_ID". In the final binary we replace this build ID with
+ @ # the computed build ID for this binary.
+ ${Q}go build -o "$@" -ldflags '-B 0x${TEMPORARY_BUILD_ID} ${GO_LDFLAGS}' -tags "${GO_BUILD_TAGS}" $(addprefix ${SOURCE_DIR}/cmd/,$(@F))
+
# This is a build hack to avoid excessive rebuilding of targets. Instead of
# depending on the Makefile, we start to depend on tool versions as defined in
# the Makefile. Like this, we only rebuild if the tool versions actually