mdbx-make: добавление .WAIT для устранения коллизий при распараллеливании сборки.

This commit is contained in:
Леонид Юрьев (Leonid Yuriev) 2024-11-24 17:50:58 +03:00
parent 6508bd5a97
commit bcf0a1273f

View File

@ -1,4 +1,4 @@
# This makefile is for GNU Make 3.80 or above, and nowadays provided # This makefile is for GNU Make 3.81 or above, and nowadays provided
# just for compatibility and preservation of traditions. # just for compatibility and preservation of traditions.
# #
# Please use CMake in case of any difficulties or # Please use CMake in case of any difficulties or
@ -16,6 +16,7 @@ ifneq ($(make_lt_3_81),0)
$(error Please use GNU Make 3.81 or above) $(error Please use GNU Make 3.81 or above)
endif endif
make_ge_4_1 := $(shell expr "$(MAKE_VERx3)" ">=" " 4 1") make_ge_4_1 := $(shell expr "$(MAKE_VERx3)" ">=" " 4 1")
make_ge_4_4 := $(shell expr "$(MAKE_VERx3)" ">=" " 4 4")
SRC_PROBE_C := $(shell [ -f mdbx.c ] && echo mdbx.c || echo src/osal.c) SRC_PROBE_C := $(shell [ -f mdbx.c ] && echo mdbx.c || echo src/osal.c)
SRC_PROBE_CXX := $(shell [ -f mdbx.c++ ] && echo mdbx.c++ || echo src/mdbx.c++) SRC_PROBE_CXX := $(shell [ -f mdbx.c++ ] && echo mdbx.c++ || echo src/mdbx.c++)
UNAME := $(shell uname -s 2>/dev/null || echo Unknown) UNAME := $(shell uname -s 2>/dev/null || echo Unknown)
@ -81,6 +82,13 @@ LDFLAGS ?= $(eval LDFLAGS := $$(shell $$(uname2ldflags)))$(LDFLAGS)
LIB_STDCXXFS ?= $(eval LIB_STDCXXFS := $$(shell echo '$$(cxx_filesystem_probe)' | cat mdbx.h++ - | sed $$$$'1s/\xef\xbb\xbf//' | $(CXX) -x c++ $(CXXFLAGS) -Wno-error - -Wl,--allow-multiple-definition -lstdc++fs $(LIBS) $(LDFLAGS) $(EXE_LDFLAGS) -o /dev/null 2>probe4lstdfs.err >/dev/null && echo '-Wl,--allow-multiple-definition -lstdc++fs'))$(LIB_STDCXXFS) LIB_STDCXXFS ?= $(eval LIB_STDCXXFS := $$(shell echo '$$(cxx_filesystem_probe)' | cat mdbx.h++ - | sed $$$$'1s/\xef\xbb\xbf//' | $(CXX) -x c++ $(CXXFLAGS) -Wno-error - -Wl,--allow-multiple-definition -lstdc++fs $(LIBS) $(LDFLAGS) $(EXE_LDFLAGS) -o /dev/null 2>probe4lstdfs.err >/dev/null && echo '-Wl,--allow-multiple-definition -lstdc++fs'))$(LIB_STDCXXFS)
endif endif
ifneq ($(make_ge_4_4),1)
.NOTPARALLEL:
WAIT =
else
WAIT = .WAIT
endif
################################################################################ ################################################################################
define uname2sosuffix define uname2sosuffix
@ -296,7 +304,7 @@ ifeq ($(wildcard mdbx.c),mdbx.c)
# Amalgamated source code, i.e. distributed after `make dist` # Amalgamated source code, i.e. distributed after `make dist`
MAN_SRCDIR := man1/ MAN_SRCDIR := man1/
config.h: @buildflags.tag mdbx.c $(lastword $(MAKEFILE_LIST)) LICENSE NOTICE config.h: @buildflags.tag $(WAIT) mdbx.c $(lastword $(MAKEFILE_LIST)) LICENSE NOTICE
@echo ' MAKE $@' @echo ' MAKE $@'
$(QUIET)(echo '#define MDBX_BUILD_TIMESTAMP "$(MDBX_BUILD_TIMESTAMP)"' \ $(QUIET)(echo '#define MDBX_BUILD_TIMESTAMP "$(MDBX_BUILD_TIMESTAMP)"' \
&& echo "#define MDBX_BUILD_FLAGS \"$$(cat @buildflags.tag)\"" \ && echo "#define MDBX_BUILD_FLAGS \"$$(cat @buildflags.tag)\"" \
@ -544,7 +552,7 @@ src/version.c: src/version.c.in $(lastword $(MAKEFILE_LIST)) $(git_DIR)/HEAD $(g
-e "s|\$${MDBX_VERSION_REVISION}|$(MDBX_GIT_REVISION)|" \ -e "s|\$${MDBX_VERSION_REVISION}|$(MDBX_GIT_REVISION)|" \
src/version.c.in >$@ src/version.c.in >$@
src/config.h: @buildflags.tag src/version.c $(lastword $(MAKEFILE_LIST)) LICENSE NOTICE src/config.h: @buildflags.tag $(WAIT) src/version.c $(lastword $(MAKEFILE_LIST)) LICENSE NOTICE
@echo ' MAKE $@' @echo ' MAKE $@'
$(QUIET)(echo '#define MDBX_BUILD_TIMESTAMP "$(MDBX_BUILD_TIMESTAMP)"' \ $(QUIET)(echo '#define MDBX_BUILD_TIMESTAMP "$(MDBX_BUILD_TIMESTAMP)"' \
&& echo "#define MDBX_BUILD_FLAGS \"$$(cat @buildflags.tag)\"" \ && echo "#define MDBX_BUILD_FLAGS \"$$(cat @buildflags.tag)\"" \
@ -614,7 +622,7 @@ mdbx++-static.o: src/config.h src/mdbx.c++ mdbx.h mdbx.h++ $(lastword $(MAKEFILE
@echo ' CC $@' @echo ' CC $@'
$(QUIET)$(CXX) $(CXXFLAGS) $(MDBX_BUILD_OPTIONS) '-DMDBX_CONFIG_H="config.h"' -ULIBMDBX_EXPORTS -c src/mdbx.c++ -o $@ $(QUIET)$(CXX) $(CXXFLAGS) $(MDBX_BUILD_OPTIONS) '-DMDBX_CONFIG_H="config.h"' -ULIBMDBX_EXPORTS -c src/mdbx.c++ -o $@
dist: tags @dist-checked.tag libmdbx-sources-$(MDBX_VERSION_IDENT).tar.gz $(lastword $(MAKEFILE_LIST)) dist: tags $(WAIT) @dist-checked.tag libmdbx-sources-$(MDBX_VERSION_IDENT).tar.gz $(lastword $(MAKEFILE_LIST))
@echo ' AMALGAMATION is done' @echo ' AMALGAMATION is done'
tags: tags: