@@ -317,26 +317,39 @@ prepare-dist::
317317# --------------------------------------------------------------------
318318
319319# If the top-level project is a RabbitMQ component, we override
320- # $(DEPS_DIR) for this project to point to the top-level's one. We also
321- # disable `make distclean` so $(DEPS_DIR) is not accidentally removed.
322-
323- ifneq ($(wildcard ../../rabbitmq-components.mk) ,)
324- supposed_deps_dir = $(abspath ..)
325- else ifneq ($(wildcard ../../../../rabbitmq-components.mk),)
326- supposed_deps_dir = $(abspath ../../..)
327- else ifneq ($(wildcard UMBRELLA.md),)
320+ # $(DEPS_DIR) for this project to point to the top-level's one.
321+ #
322+ # We also verify that the guessed DEPS_DIR is actually named `deps`,
323+ # to rule out any situation where it is a coincidence that we found a
324+ # `rabbitmq-components.mk` up upper directories.
325+
326+ possible_deps_dir_1 = $(abspath ..)
327+ possible_deps_dir_2 = $(abspath ../../..)
328+
329+ ifeq ($(notdir $(possible_deps_dir_1 ) ) ,deps)
330+ ifneq ($(wildcard $(possible_deps_dir_1 ) /../rabbitmq-components.mk) ,)
331+ deps_dir_overriden = 1
332+ DEPS_DIR ?= $(possible_deps_dir_1 )
328333DISABLE_DISTCLEAN = 1
329334endif
335+ endif
330336
331- # We also verify that the guessed DEPS_DIR is actually named `deps`, to rule
332- # out any situation where it is a coincidence that we found a
333- # `rabbitmq-components.mk` up upper directories.
337+ ifeq ($(deps_dir_overriden ) ,)
338+ ifeq ($(notdir $(possible_deps_dir_2 ) ) ,deps)
339+ ifneq ($(wildcard $(possible_deps_dir_2 ) /../rabbitmq-components.mk) ,)
340+ deps_dir_overriden = 1
341+ DEPS_DIR ?= $(possible_deps_dir_2 )
342+ DISABLE_DISTCLEAN = 1
343+ endif
344+ endif
345+ endif
334346
335- ifeq ($(notdir $( supposed_deps_dir ) ) ,deps )
347+ ifneq ($(wildcard UMBRELLA.md) , )
336348DISABLE_DISTCLEAN = 1
337- DEPS_DIR ?= $(supposed_deps_dir )
338349endif
339350
351+ # We disable `make distclean` so $(DEPS_DIR) is not accidentally removed.
352+
340353ifeq ($(DISABLE_DISTCLEAN ) ,1)
341354ifneq ($(filter distclean distclean-deps,$(MAKECMDGOALS ) ) ,)
342355SKIP_DEPS = 1
0 commit comments