Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 550870f

Browse files
committed
Update rabbitmq-components.mk
1 parent 779a53a commit 550870f

File tree

1 file changed

+26
-13
lines changed

1 file changed

+26
-13
lines changed

rabbitmq-components.mk

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -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)
328333
DISABLE_DISTCLEAN = 1
329334
endif
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),)
336348
DISABLE_DISTCLEAN = 1
337-
DEPS_DIR ?= $(supposed_deps_dir)
338349
endif
339350

351+
# We disable `make distclean` so $(DEPS_DIR) is not accidentally removed.
352+
340353
ifeq ($(DISABLE_DISTCLEAN),1)
341354
ifneq ($(filter distclean distclean-deps,$(MAKECMDGOALS)),)
342355
SKIP_DEPS = 1

0 commit comments

Comments
 (0)