From b5def26565fbb180392f6ef4609dd613715d08f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9B=D0=B5=D0=BE=D0=BD=D0=B8=D0=B4=20=D0=AE=D1=80=D1=8C?= =?UTF-8?q?=D0=B5=D0=B2=20=28Leonid=20Yuriev=29?= Date: Tue, 12 Nov 2024 20:44:08 +0300 Subject: [PATCH] =?UTF-8?q?mdbx-make:=20=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20=D1=86=D0=B5=D0=BB=D0=B5=D0=B9?= =?UTF-8?q?=20`cmake-build`=20=D0=B8=20`ninja`.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GNUmakefile | 17 +++++++++++++---- Makefile | 2 +- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index 8eabcf19..7c2b0291 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -51,6 +51,8 @@ CC ?= gcc CXX ?= g++ CFLAGS_EXTRA ?= LD ?= ld +CMAKE ?= cmake +CMAKE_OPT ?= # build options MDBX_BUILD_OPTIONS ?=-DNDEBUG=1 @@ -127,7 +129,7 @@ MANPAGES := mdbx_stat.1 mdbx_copy.1 mdbx_dump.1 mdbx_load.1 mdbx_chk.1 mdbx_dr TIP := // TIP: .PHONY: all help options lib libs tools clean install uninstall check_buildflags_tag tools-static -.PHONY: install-strip install-no-strip strip libmdbx mdbx show-options lib-static lib-shared +.PHONY: install-strip install-no-strip strip libmdbx mdbx show-options lib-static lib-shared cmake-build ninja boolean = $(if $(findstring $(strip $($1)),YES Yes yes y ON On on 1 true True TRUE),1,$(if $(findstring $(strip $($1)),NO No no n OFF Off off 0 false False FALSE),,$(error Wrong value `$($1)` of $1 for YES/NO option))) select_by = $(if $(call boolean,$(1)),$(2),$(3)) @@ -161,6 +163,7 @@ help: @echo " make clean " @echo " make install " @echo " make uninstall " + @echo " make cmake-build | ninja - build by CMake & Ninja" @echo "" @echo " make strip - strip debug symbols from binaries" @echo " make install-no-strip - install explicitly without strip" @@ -257,7 +260,7 @@ clean: $(QUIET)rm -rf $(MDBX_TOOLS) mdbx_test @* *.[ao] *.[ls]o *.$(SO_SUFFIX) *.dSYM *~ tmp.db/* \ *.gcov *.log *.err src/*.o test/*.o mdbx_example dist @dist-check \ config.h src/config.h src/version.c *.tar* @buildflags.tag @dist-checked.tag \ - mdbx_*.static mdbx_*.static-lto + mdbx_*.static mdbx_*.static-lto CMakeFiles MDBX_BUILD_FLAGS =$(strip MDBX_BUILD_CXX=$(MDBX_BUILD_CXX) $(MDBX_BUILD_OPTIONS) $(call select_by,MDBX_BUILD_CXX,$(CXXFLAGS) $(LDFLAGS) $(LIB_STDCXXFS) $(LIBS),$(CFLAGS) $(LDFLAGS) $(LIBS))) check_buildflags_tag: @@ -277,6 +280,11 @@ lib-shared libmdbx.$(SO_SUFFIX): mdbx-dylib.o $(call select_by,MDBX_BUILD_CXX,md @echo ' LD $@' $(QUIET)$(call select_by,MDBX_BUILD_CXX,$(CXX) $(CXXFLAGS),$(CC) $(CFLAGS)) $^ -pthread -shared $(LDFLAGS) $(call select_by,MDBX_BUILD_CXX,$(LIB_STDCXXFS)) $(LIBS) -o $@ +ninja: cmake-build +cmake-build: + @echo "-G Ninja . && cmake --build ." + $(QUIET)mkdir @cmake-ninja-build && $(CMAKE) $(CMAKE_OPT) -G Ninja -S . -B @cmake-ninja-build && $(CMAKE) --build @cmake-ninja-build + #> dist-cutoff-begin ifeq ($(wildcard mdbx.c),mdbx.c) #< dist-cutoff-end @@ -392,7 +400,8 @@ MDBX_DIST_DIR = libmdbx-$(MDBX_VERSION_NODOT) MDBX_SMOKE_EXTRA ?= check: DESTDIR = $(shell pwd)/@check-install -check: test dist install +check: CMAKE_OPT = -Werror=dev +check: smoke-assertion ninja dist install test smoke-assertion: MDBX_BUILD_OPTIONS:=$(strip $(MDBX_BUILD_OPTIONS) -DMDBX_FORCE_ASSERTIONS=1 -UNDEBUG -DMDBX_DEBUG=0) smoke-assertion: smoke @@ -623,7 +632,7 @@ release-assets: libmdbx-amalgamated-$(MDBX_GIT_VERSION).zpaq \ @echo -n ' VERIFY amalgamated sources...' $(QUIET)rm -rf $@ dist/@tmp-essentials.inc dist/@tmp-internals.inc \ && if grep -R "define xMDBX_ALLOY" dist | grep -q MDBX_BUILD_SOURCERY; then echo "sed output is WRONG!" >&2; exit 2; fi \ - && rm -rf @dist-check && cp -r -p dist @dist-check && ($(MAKE) IOARENA=false CXXSTD=$(CXXSTD) -C @dist-check >@dist-check.log 2>@dist-check.err || (cat @dist-check.err && exit 1)) \ + && rm -rf @dist-check && cp -r -p dist @dist-check && ($(MAKE) -j IOARENA=false CXXSTD=$(CXXSTD) -C @dist-check all ninja >@dist-check.log 2>@dist-check.err || (cat @dist-check.err && exit 1)) \ && touch $@ || (echo " FAILED! See @dist-check.log and @dist-check.err" >&2; exit 2) && echo " Ok" %.tar.gz: @dist-checked.tag diff --git a/Makefile b/Makefile index 78ba3483..8a176ceb 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ # This is thunk-Makefile for calling GNU Make 3.80 or above -all help options \ +all help options cmake-build ninja \ clean install install-no-strip install-strip strip tools uninstall \ bench bench-clean bench-couple bench-quartet bench-triplet re-bench \ lib libs lib-static lib-shared tools-static \