Skip to content

Commit

Permalink
makefile: fix shell tab-completions (#147)
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
isaac-io committed Oct 19, 2022
1 parent 4f292a6 commit 8d41adc
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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

Expand Down

0 comments on commit 8d41adc

Please sign in to comment.