From 8d41adced223aa631731104b899adf9e0d683a5e Mon Sep 17 00:00:00 2001 From: Isaac Garzon <isaac@speedb.io> Date: Tue, 30 Aug 2022 17:50:20 +0300 Subject: [PATCH] makefile: fix shell tab-completions (#147) Shell tab-completions are currently broken due to the regeneration of `make_config.mk` on every invocation, which also causes a make restart. Prevent regeneration if the file exists and we're in an invocation that doesn't execute rule recipes (-n or -q). --- Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Makefile b/Makefile index 972e61ef05..65d0c69cf5 100644 --- a/Makefile +++ b/Makefile @@ -217,6 +217,9 @@ am__v_AR_1 = AM_LINK = $(AM_V_CCLD)$(CXX) -L. $(patsubst lib%.a, -l%, $(patsubst lib%.$(PLATFORM_SHARED_EXT), -l%, $^)) $(EXEC_LDFLAGS) -o $@ $(LDFLAGS) $(COVERAGEFLAGS) AM_SHARE = $(AM_V_CCLD) $(CXX) $(PLATFORM_SHARED_LDFLAGS)$@ -L. $(patsubst lib%.$(PLATFORM_SHARED_EXT), -l%, $^) $(EXEC_LDFLAGS) $(LDFLAGS) -o $@ +# Only regenerate make_config.mk if it doesn't exists or if we're invoked in a mode +# that executes target recipes (i.e. not -n or -q) +ifeq ($(and $(or $(findstring n,$(MAKEFLAGS)),$(findstring q,$(MAKEFLAGS))),$(wildcard make_config.mk)),) # Detect what platform we're building on. # Export some common variables that might have been passed as Make variables # instead of environment variables. @@ -232,6 +235,7 @@ dummy := $(shell (export ROCKSDB_ROOT="$(CURDIR)"; \ export LIB_MODE="$(LIB_MODE)"; \ export ROCKSDB_CXX_STANDARD="$(ROCKSDB_CXX_STANDARD)"; \ "$(CURDIR)/build_tools/build_detect_platform" "$(CURDIR)/make_config.mk")) +endif # this file is generated by the previous line to set build flags and sources include make_config.mk