Skip to content
This repository has been archived by the owner on Nov 16, 2020. It is now read-only.

Commit

Permalink
Update rabbitmq-components.mk
Browse files Browse the repository at this point in the history
  • Loading branch information
dumbbell committed Sep 21, 2020
1 parent 5e9b401 commit 48b2d05
Showing 1 changed file with 26 additions and 13 deletions.
39 changes: 26 additions & 13 deletions rabbitmq-components.mk
Original file line number Diff line number Diff line change
Expand Up @@ -317,26 +317,39 @@ prepare-dist::
# --------------------------------------------------------------------

# If the top-level project is a RabbitMQ component, we override
# $(DEPS_DIR) for this project to point to the top-level's one. We also
# disable `make distclean` so $(DEPS_DIR) is not accidentally removed.

ifneq ($(wildcard ../../rabbitmq-components.mk),)
supposed_deps_dir = $(abspath ..)
else ifneq ($(wildcard ../../../../rabbitmq-components.mk),)
supposed_deps_dir = $(abspath ../../..)
else ifneq ($(wildcard UMBRELLA.md),)
# $(DEPS_DIR) for this project to point to the top-level's one.
#
# We also verify that the guessed DEPS_DIR is actually named `deps`,
# to rule out any situation where it is a coincidence that we found a
# `rabbitmq-components.mk` up upper directories.

possible_deps_dir_1 = $(abspath ..)
possible_deps_dir_2 = $(abspath ../../..)

ifeq ($(notdir $(possible_deps_dir_1)),deps)
ifneq ($(wildcard $(possible_deps_dir_1)/../rabbitmq-components.mk),)
deps_dir_overriden = 1
DEPS_DIR ?= $(possible_deps_dir_1)
DISABLE_DISTCLEAN = 1
endif
endif

# We also verify that the guessed DEPS_DIR is actually named `deps`, to rule
# out any situation where it is a coincidence that we found a
# `rabbitmq-components.mk` up upper directories.
ifeq ($(deps_dir_overriden),)
ifeq ($(notdir $(possible_deps_dir_2)),deps)
ifneq ($(wildcard $(possible_deps_dir_2)/../rabbitmq-components.mk),)
deps_dir_overriden = 1
DEPS_DIR ?= $(possible_deps_dir_2)
DISABLE_DISTCLEAN = 1
endif
endif
endif

ifeq ($(notdir $(supposed_deps_dir)),deps)
ifneq ($(wildcard UMBRELLA.md),)
DISABLE_DISTCLEAN = 1
DEPS_DIR ?= $(supposed_deps_dir)
endif

# We disable `make distclean` so $(DEPS_DIR) is not accidentally removed.

ifeq ($(DISABLE_DISTCLEAN),1)
ifneq ($(filter distclean distclean-deps,$(MAKECMDGOALS)),)
SKIP_DEPS = 1
Expand Down

0 comments on commit 48b2d05

Please sign in to comment.