fix regression supporting HOST, NATIVE vars set from config.mak

the logic for processing the NATIVE var (shortcut for HOST=$(TARGET))
and HOST var took place before inclusion of config.mak, causing NATIVE
not to be honored and wrong BUILD_DIR and OUTPUT defaults to be used
if either was set from config.mak rather than on the make command
line. the current preferred interface is the command line, but the
regression was unintentional.

to fix it, replace the conditional blocks of the makefile with
conditional functions in recursively-expanded variables HOST,
BUILD_DIR, and OUTPUT. this way, assignments to NATIVE or HOST that
take place later in config.mak will affect the resulting values, as
intended.
This commit is contained in:
Rich Felker 2018-08-05 21:36:14 -04:00
parent 1e04a0d998
commit 5dd1a49567
1 changed files with 3 additions and 11 deletions

View File

@ -25,17 +25,9 @@ LINUX_SITE = https://cdn.kernel.org/pub/linux/kernel
DL_CMD = wget -c -O DL_CMD = wget -c -O
ifneq ($(NATIVE),) HOST = $(if $(NATIVE),$(TARGET))
HOST := $(TARGET) BUILD_DIR = build/$(if $(HOST),$(HOST),local)/$(TARGET)
endif OUTPUT = $(CURDIR)/output$(if $(HOST),-$(HOST))
ifneq ($(HOST),)
BUILD_DIR = build/$(HOST)/$(TARGET)
OUTPUT = $(CURDIR)/output-$(HOST)
else
BUILD_DIR = build/local/$(TARGET)
OUTPUT = $(CURDIR)/output
endif
REL_TOP = ../../.. REL_TOP = ../../..