Skip to content

Commit

Permalink
Makefile.legacy: fix recursive invocation with BUILDROOT_DL_DIR and _…
Browse files Browse the repository at this point in the history
…CONFIG

The legacy support for the old BUILDROOT_DL_DIR and BUILDROOT_CONFIG
breaks down when make is invoked recursively - which is done in a few
cases, e.g. silentoldconfig, external-defs, ... These targets always
give a legacy error.

For BUILDROOT_DL_DIR, this is fixed by making sure that the original
value of BR2_DL_DIR taken from the environment is also exported again.

For BUILDROOT_CONFIG, this is fixed with an additional comparison of
the environment variable's value with the fake value that we introduce
ourselves.

Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Tested-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
  • Loading branch information
arnout authored and jacmet committed Feb 11, 2014
1 parent 28f427d commit af97c94
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
10 changes: 7 additions & 3 deletions Makefile.legacy
Expand Up @@ -28,16 +28,20 @@ $(error "The BUILDROOT_DL_DIR environment variable was renamed to BR2_DL_DIR.")
endif
endif

# If a script is using the deprecated BUILDROOT_CONFIG, make sure it fails.
# Add some directories in front just in case someone used dirname on it.
BUILDROOT_CONFIG_FAKE = /tmp/deprecated/The-BUILDROOT_CONFIG-environment-variable-was-renamed-to-BR2_CONFIG

# Similar to above for BUILDROOT_CONFIG, but here we have no .config equivalent.
ifneq ($(BUILDROOT_CONFIG),)
ifneq ($(BUILDROOT_CONFIG),$(BR2_CONFIG))
ifneq ($(BUILDROOT_CONFIG),$(BUILDROOT_CONFIG_FAKE))
$(error "The BUILDROOT_CONFIG environment variable was renamed to BR2_CONFIG.")
endif
endif
endif

# If a script is using the deprecated BUILDROOT_CONFIG, make sure it fails.
# Add some directories in front just in case someone used dirname on it.
BUILDROOT_CONFIG = /tmp/deprecated/The-BUILDROOT_CONFIG-environment-variable-was-renamed-to-BR2_CONFIG
BUILDROOT_CONFIG = $(BUILDROOT_CONFIG_FAKE)
export BUILDROOT_CONFIG

#
Expand Down
5 changes: 5 additions & 0 deletions package/pkg-download.mk
Expand Up @@ -24,10 +24,15 @@ LOCALFILES := $(call qstrip,$(BR2_LOCALFILES))
DL_MODE=DOWNLOAD

# DL_DIR may have been set already from the environment
ifeq ($(origin DL_DIR),undefined)
DL_DIR ?= $(call qstrip,$(BR2_DL_DIR))
ifeq ($(DL_DIR),)
DL_DIR := $(TOPDIR)/dl
endif
else
# Restore the BR2_DL_DIR that was overridden by the .config file
BR2_DL_DIR = $(DL_DIR)
endif

# ensure it exists and a absolute path
DL_DIR := $(shell mkdir -p $(DL_DIR) && cd $(DL_DIR) >/dev/null && pwd)
Expand Down

0 comments on commit af97c94

Please sign in to comment.