From 9e42fc4fe016b50911b17a1568eba73289b52bae Mon Sep 17 00:00:00 2001 From: Leonid Yuriev Date: Fri, 11 Oct 2019 15:54:54 +0300 Subject: [PATCH] mdbx-build: fix GNUmakefile for git-submodule case. Change-Id: Ideae8035e776c338a3a5cd4a5c0f2ce8266541e9 --- GNUmakefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/GNUmakefile b/GNUmakefile index bc582a1b..a8d8d7a8 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -175,7 +175,9 @@ mdbx_%: src/tools/mdbx_%.c libmdbx.a mdbx_test: $(TEST_OBJ) libmdbx.$(SO_SUFFIX) $(CXX) $(CXXFLAGS) $(TEST_OBJ) -Wl,-rpath . -L . -l mdbx $(EXE_LDFLAGS) -o $@ -src/elements/version.c: src/elements/version.c.in $(lastword $(MAKEFILE_LIST)) .git/HEAD .git/index .git/refs/tags +git_DIR := $(shell if [ -d .git ]; then echo .git; elif [ -s .git -a -f .git ]; then grep '^gitdir: ' .git | cut -d ':' -f 2; else echo "Please use libmdbx as a git-submodule or the amalgamated source code" >&2 && echo git_directory; fi) + +src/elements/version.c: src/elements/version.c.in $(lastword $(MAKEFILE_LIST)) $(git_DIR)/HEAD $(git_DIR)/index $(git_DIR)/refs/tags sed \ -e "s|@MDBX_GIT_TIMESTAMP@|$(MDBX_GIT_TIMESTAMP)|" \ -e "s|@MDBX_GIT_TREE@|$(shell git show --no-patch --format=%T HEAD || echo 'Please install latest get version')|" \