From 5dd1a49567567c1eada595dbceff7672a1855792 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Sun, 5 Aug 2018 21:36:14 -0400 Subject: [PATCH] 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. --- Makefile | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index fe80d64..58bfa05 100644 --- a/Makefile +++ b/Makefile @@ -25,17 +25,9 @@ LINUX_SITE = https://cdn.kernel.org/pub/linux/kernel DL_CMD = wget -c -O -ifneq ($(NATIVE),) -HOST := $(TARGET) -endif - -ifneq ($(HOST),) -BUILD_DIR = build/$(HOST)/$(TARGET) -OUTPUT = $(CURDIR)/output-$(HOST) -else -BUILD_DIR = build/local/$(TARGET) -OUTPUT = $(CURDIR)/output -endif +HOST = $(if $(NATIVE),$(TARGET)) +BUILD_DIR = build/$(if $(HOST),$(HOST),local)/$(TARGET) +OUTPUT = $(CURDIR)/output$(if $(HOST),-$(HOST)) REL_TOP = ../../..