diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2021-03-05 12:21:29 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2021-03-09 10:54:51 +0300 |
commit | 21abc5a7ac4afe9587169be495b3316e85a613fe (patch) | |
tree | 0a332404fe03b50d1af695a646e7ba5ef6ab6454 /Makefile | |
parent | bee2da5c622b4b9ca3c625969c063c2f1d8a88c6 (diff) |
Makefile: Do not redownload protoc.zip if it's up-to-date
The protoc target is currently always re-downloading the protoc archive
whenever the Makefile changes. This is inefficient: in most cases it
didn't change anyway.
Fix this by instead using a `protoc.version` file, similar to how we
handle rebuilds of git and libgit2. This allows us to only redownload
protoc in case the protoc version changed.
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -419,6 +419,8 @@ ${DEPENDENCY_DIR}/libgit2.version: dependency-version | ${DEPENDENCY_DIR} ${Q}[ x"$$(cat "$@" 2>/dev/null)" = x"${LIBGIT2_VERSION}" ] || >$@ echo -n "${LIBGIT2_VERSION}" ${DEPENDENCY_DIR}/git.version: dependency-version | ${DEPENDENCY_DIR} ${Q}[ x"$$(cat "$@" 2>/dev/null)" = x"${GIT_VERSION}" ] || >$@ echo -n "${GIT_VERSION}" +${TOOLS_DIR}/protoc.version: dependency-version | ${TOOLS_DIR} + ${Q}[ x"$$(cat "$@" 2>/dev/null)" = x"${PROTOC_VERSION}" ] || >$@ echo -n "${PROTOC_VERSION}" ${LIBGIT2_INSTALL_DIR}/lib/libgit2.a: ${DEPENDENCY_DIR}/libgit2.version ${Q}${GIT} init --initial-branch=master ${GIT_QUIET} ${LIBGIT2_SOURCE_DIR} @@ -454,7 +456,7 @@ ${GIT_INSTALL_DIR}/bin/git: ${DEPENDENCY_DIR}/git_full_bins.tgz tar -C ${GIT_INSTALL_DIR} -xvzf ${DEPENDENCY_DIR}/git_full_bins.tgz endif -${BUILD_DIR}/protoc.zip: ${BUILD_DIR}/Makefile.sha256 +${BUILD_DIR}/protoc.zip: ${TOOLS_DIR}/protoc.version ${Q}if [ -z "${PROTOC_URL}" ]; then echo "Cannot generate protos on unsupported platform ${OS}" && exit 1; fi curl -o $@.tmp --silent --show-error -L ${PROTOC_URL} ${Q}printf '${PROTOC_HASH} $@.tmp' | sha256sum -c - |