build: permit overwrite PACKAGE_DIR and PACKAGE_DIR_ALL

Permit to overwrite PACKAGE_DIR and PACKAGE_DIR_ALL variables in
rules.mk.

This is to handle a special case with the ImageBuilder where these
variable are overwrite.

The main problem is that any include calling rules.mk again (example
image.mk) will set these variables again dropping the modified value.

To keep the modified value, set the PACKAGE_DIR and PACKAGE_DIR_ALL only
if not already set. This permits the ImageBuilder to use custom
directory instead of the default one defined in rules.mk.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
This commit is contained in:
Christian Marangi 2024-10-24 20:13:07 +02:00
parent 221f81a330
commit 5667b380cd
No known key found for this signature in database
GPG Key ID: AC001D09ADBFEAD7

View File

@ -141,8 +141,8 @@ ifeq ($(or $(CONFIG_EXTERNAL_TOOLCHAIN),$(CONFIG_TARGET_uml)),)
iremap = -f$(if $(CONFIG_REPRODUCIBLE_DEBUG_INFO),file,macro)-prefix-map=$(1)=$(2)
endif
PACKAGE_DIR:=$(BIN_DIR)/packages
PACKAGE_DIR_ALL:=$(TOPDIR)/staging_dir/packages/$(BOARD)
PACKAGE_DIR?=$(BIN_DIR)/packages
PACKAGE_DIR_ALL?=$(TOPDIR)/staging_dir/packages/$(BOARD)
BUILD_DIR:=$(BUILD_DIR_BASE)/$(TARGET_DIR_NAME)
STAGING_DIR:=$(TOPDIR)/staging_dir/$(TARGET_DIR_NAME)
BUILD_DIR_TOOLCHAIN:=$(BUILD_DIR_BASE)/$(TOOLCHAIN_DIR_NAME)