mdbx-make: support for make help to list available make targets.

Change-Id: I72b92101a494fc7b507f54259c3db69990ce5a2d
This commit is contained in:
Leonid Yuriev 2021-05-01 01:02:28 +03:00
parent 547c8dd3f2
commit dfeb6b5acb
5 changed files with 75 additions and 27 deletions

View File

@ -1671,6 +1671,7 @@ testcase
testdb testdb
TESTLIST TESTLIST
TESTLOG TESTLOG
testset
Thermi Thermi
thr thr
THREADENTRY THREADENTRY

View File

@ -33,6 +33,7 @@ New features:
- Added `MDBX_ENABLE_MADVISE` build option which controls the use of POSIX `madvise()` hints and friends. - Added `MDBX_ENABLE_MADVISE` build option which controls the use of POSIX `madvise()` hints and friends.
- The internal node sizes were refined, resulting in a reduction in large/overflow pages in some use cases and a slight increase in limits for a keys size. - The internal node sizes were refined, resulting in a reduction in large/overflow pages in some use cases and a slight increase in limits for a keys size.
- Support `make options` to list available build options. - Support `make options` to list available build options.
- Support `make help` to list available make targets.
Backward compatibility break: Backward compatibility break:

View File

@ -45,15 +45,66 @@ EXE_LDFLAGS ?= -pthread
################################################################################ ################################################################################
.PHONY: mdbx all install install-strip install-no-strip clean options UNAME := $(shell uname -s 2>/dev/null || echo Unknown)
define uname2sosuffix
case "$(UNAME)" in
Darwin*|Mach*) echo dylib;;
CYGWIN*|MINGW*|MSYS*|Windows*) echo dll;;
*) echo so;;
esac
endef
SO_SUFFIX := $(shell $(uname2sosuffix)) SO_SUFFIX := $(shell $(uname2sosuffix))
HEADERS := mdbx.h mdbx.h++ HEADERS := mdbx.h mdbx.h++
LIBRARIES := libmdbx.a libmdbx.$(SO_SUFFIX) LIBRARIES := libmdbx.a libmdbx.$(SO_SUFFIX)
TOOLS := mdbx_stat mdbx_copy mdbx_dump mdbx_load mdbx_chk mdbx_drop TOOLS := mdbx_stat mdbx_copy mdbx_dump mdbx_load mdbx_chk mdbx_drop
MANPAGES := mdbx_stat.1 mdbx_copy.1 mdbx_dump.1 mdbx_load.1 mdbx_chk.1 mdbx_drop.1 MANPAGES := mdbx_stat.1 mdbx_copy.1 mdbx_dump.1 mdbx_load.1 mdbx_chk.1 mdbx_drop.1
.PHONY: all help options lib tools clean install uninstall
.PHONY: install-strip install-no-strip strip libmdbx mdbx
all: options $(LIBRARIES) $(TOOLS) all: options $(LIBRARIES) $(TOOLS)
help:
@echo " make all - build libraries and tools"
@echo " make help - print this help"
@echo " make options - list build options"
@echo " make lib - build libraries"
@echo " make tools - built tools"
@echo " make clean "
@echo " make install "
@echo " make uninstall "
@echo ""
@echo " make strip - strip debug symbols from binaries"
@echo " make install-no-strip - install explicitly without strip"
@echo " make install-strip - install explicitly with strip"
@echo ""
@echo " make bench - run ioarena-benchmark"
@echo " make bench-couple - run ioarena-benchmark for mdbx and lmdb"
@echo " make bench-triplet - run ioarena-benchmark for mdbx, lmdb, sqlite3"
@echo " make bench-quartet - run ioarena-benchmark for mdbx, lmdb, rocksdb, wiredtiger"
@echo " make bench-clean - remove temp database(s) after benchmark"
#> dist-cutoff-begin
@echo ""
@echo " make test - basic test"
@echo " make check - basic test"
@echo " make memcheck - build with Valgrind's and test with memcheck tool"
@echo " make test-valgrind - build with Valgrind's and test with memcheck tool"
@echo " make test-asan - build with AddressSanitizer and test"
@echo " make test-leak - build with LeakSanitizer and test"
@echo " make test-ubsan - build with UndefinedBehaviourSanitizer and test"
@echo " make cross-gcc - run cross-compilation testset"
@echo " make cross-qemu - run cross-compilation and execution testset with QEMU"
@echo " make gcc-analyzer - run gcc-analyzer (mostly useless for now)"
@echo " make build-test - build test executable(s)"
@echo " make test-fault - run transaction owner failure testcase"
@echo " make test-singleprocess - run single-process test (used by make cross-qemu)"
@echo ""
@echo " make dist - build amalgamated source code"
@echo " make doxygen - build HTML documentation"
@echo " make release-assets - build release assets"
@echo " make reformat - reformat source code with clang-format"
#< dist-cutoff-end
options: options:
@echo " INSTALL =$(INSTALL)" @echo " INSTALL =$(INSTALL)"
@echo " DESTDIR =$(DESTDIR)" @echo " DESTDIR =$(DESTDIR)"
@ -90,16 +141,7 @@ else
endif endif
#< dist-cutoff-end #< dist-cutoff-end
UNAME := $(shell uname -s 2>/dev/null || echo Unknown) lib libmdbx mdbx: libmdbx.a libmdbx.$(SO_SUFFIX)
define uname2sosuffix
case "$(UNAME)" in
Darwin*|Mach*) echo dylib;;
CYGWIN*|MINGW*|MSYS*|Windows*) echo dll;;
*) echo so;;
esac
endef
mdbx: libmdbx.a libmdbx.$(SO_SUFFIX)
tools: $(TOOLS) tools: $(TOOLS)
@ -152,7 +194,9 @@ else
################################################################################ ################################################################################
# Plain (non-amalgamated) sources with test # Plain (non-amalgamated) sources with test
.PHONY: test dist check doxygen reformat .PHONY: build-test check cross-gcc cross-qemu dist doxygen gcc-analyzer
.PHONY: reformat release-assets tags test test-asan test-fault test-leak
.PHONY: test-singleprocess test-ubsan test-valgrind memcheck
define uname2osal define uname2osal
case "$(UNAME)" in case "$(UNAME)" in
@ -334,7 +378,6 @@ mdbx++-dylib.o: src/config.h src/mdbx.c++ mdbx.h mdbx.h++ $(lastword $(MAKEFILE_
mdbx++-static.o: src/config.h src/mdbx.c++ mdbx.h mdbx.h++ $(lastword $(MAKEFILE_LIST)) mdbx++-static.o: src/config.h src/mdbx.c++ mdbx.h mdbx.h++ $(lastword $(MAKEFILE_LIST))
$(CXX) $(CXXFLAGS) $(MDBX_BUILD_OPTIONS) '-DMDBX_CONFIG_H="config.h"' -ULIBMDBX_EXPORTS -c src/mdbx.c++ -o $@ $(CXX) $(CXXFLAGS) $(MDBX_BUILD_OPTIONS) '-DMDBX_CONFIG_H="config.h"' -ULIBMDBX_EXPORTS -c src/mdbx.c++ -o $@
.PHONY: dist release-assets tags
dist: tags dist-checked.tag libmdbx-sources-$(MDBX_VERSION_SUFFIX).tar.gz $(lastword $(MAKEFILE_LIST)) dist: tags dist-checked.tag libmdbx-sources-$(MDBX_VERSION_SUFFIX).tar.gz $(lastword $(MAKEFILE_LIST))
tags: tags:
@ -488,12 +531,12 @@ BENCH_CRUD_MODE ?= nosync
ifneq ($(wildcard $(IOARENA)),) ifneq ($(wildcard $(IOARENA)),)
.PHONY: bench clean-bench re-bench .PHONY: bench bench-clean bench-couple re-bench bench-quartet bench-triplet
clean-bench: bench-clean:
rm -rf bench-*.txt _ioarena/* rm -rf bench-*.txt _ioarena/*
re-bench: clean-bench bench re-bench: bench-clean bench
define bench-rule define bench-rule
bench-$(1)_$(2).txt: $(3) $(IOARENA) $(lastword $(MAKEFILE_LIST)) bench-$(1)_$(2).txt: $(3) $(IOARENA) $(lastword $(MAKEFILE_LIST))
@ -520,17 +563,13 @@ $(eval $(call bench-rule,sqlite3,$(NN)))
$(eval $(call bench-rule,ejdb,$(NN))) $(eval $(call bench-rule,ejdb,$(NN)))
$(eval $(call bench-rule,vedisdb,$(NN))) $(eval $(call bench-rule,vedisdb,$(NN)))
$(eval $(call bench-rule,dummy,$(NN))) $(eval $(call bench-rule,dummy,$(NN)))
$(eval $(call bench-rule,debug,10))
bench: bench-mdbx_$(NN).txt bench: bench-mdbx_$(NN).txt
.PHONY: bench-debug
bench-debug: bench-debug_10.txt
bench-quartet: bench-mdbx_$(NN).txt bench-lmdb_$(NN).txt bench-rocksdb_$(NN).txt bench-wiredtiger_$(NN).txt bench-quartet: bench-mdbx_$(NN).txt bench-lmdb_$(NN).txt bench-rocksdb_$(NN).txt bench-wiredtiger_$(NN).txt
bench-triplet: bench-mdbx_$(NN).txt bench-lmdb_$(NN).txt bench-sqlite3_$(NN).txt bench-triplet: bench-mdbx_$(NN).txt bench-lmdb_$(NN).txt bench-sqlite3_$(NN).txt
bench-couple: bench-mdbx_$(NN).txt bench-lmdb_$(NN).txt bench-couple: bench-mdbx_$(NN).txt bench-lmdb_$(NN).txt
# $(eval $(call bench-rule,debug,10))
# .PHONY: bench-debug
# bench-debug: bench-debug_10.txt
endif endif

View File

@ -1,7 +1,12 @@
# This is thunk-Makefile for calling GNU Make 3.80 or above # This is thunk-Makefile for calling GNU Make 3.80 or above
all options bench bench-quartet build-test check clean clean-bench cross-gcc cross-qemu dist doxygen gcc-analyzer install mdbx memcheck reformat release-assets strip test test-asan test-fault test-leak test-singleprocess test-ubsan test-valgrind tools \ all help options \
mdbx_test mdbx_chk mdbx_load mdbx_dump mdbx_stat mdbx_drop mdbx_copy: clean install install-no-strip install-strip strip tools uninstall \
bench bench-clean bench-couple bench-quartet bench-triplet re-bench \
lib libmdbx mdbx mdbx_chk mdbx_copy mdbx_drop mdbx_dump mdbx_load mdbx_stat \
check dist memcheck cross-gcc cross-qemu doxygen gcc-analyzer reformat \
release-assets tags test build-test mdbx_test \
test-asan test-fault test-leak test-singleprocess test-ubsan test-valgrind:
@CC=$(CC) \ @CC=$(CC) \
CXX=`if test -n "$(CXX)" && which "$(CXX)" > /dev/null; then echo "$(CXX)"; elif test -n "$(CCC)" && which "$(CCC)" > /dev/null; then echo "$(CCC)"; else echo "c++"; fi` \ CXX=`if test -n "$(CXX)" && which "$(CXX)" > /dev/null; then echo "$(CXX)"; elif test -n "$(CCC)" && which "$(CCC)" > /dev/null; then echo "$(CCC)"; else echo "c++"; fi` \
`which gmake || which gnumake || echo 'echo "GNU Make 3.80 or above is required"; exit 2;'` \ `which gmake || which gnumake || echo 'echo "GNU Make 3.80 or above is required"; exit 2;'` \

View File

@ -372,7 +372,9 @@ are completely traditional and have minimal prerequirements like
`build-essential`, i.e. the non-obsolete C/C++ compiler and a `build-essential`, i.e. the non-obsolete C/C++ compiler and a
[SDK](https://en.wikipedia.org/wiki/Software_development_kit) for the [SDK](https://en.wikipedia.org/wiki/Software_development_kit) for the
target platform. Obviously you need building tools itself, i.e. `git`, target platform. Obviously you need building tools itself, i.e. `git`,
`cmake` or GNU `make` with `bash`. `cmake` or GNU `make` with `bash`. For your convenience, `make help`
and `make options` are also available for listing existing targets
and build options respectively.
So just using CMake or GNU Make in your habitual manner and feel free to So just using CMake or GNU Make in your habitual manner and feel free to
fill an issue or make pull request in the case something will be fill an issue or make pull request in the case something will be