From 543c79224c1c7f46835187976025311a36f4204b Mon Sep 17 00:00:00 2001 From: Nico Huber Date: Tue, 22 Feb 2022 18:58:48 +0100 Subject: [PATCH] libpayload/Makefile.payload: Revise config strategy Payloads often just use one of the defconfigs for libpayload. When the `Makefile.payload` was introduced, it also added dependencies to pass a `make oldconfig` or `make defconfig` for the payload on to libpayload. Turned out, this creates some dependency madness when, for instance, `make oldconfig` gets called without a libpay- load `.config` available, or when we try to include the `.config` in the `Makefile`. To make things worse, Kconfig's `Makefile` that is imported from Linux contains some rarely used paths that are generally incompa- tible to our environment. So let's get rid of the hard-to-control automatism. Payloads that don't want to use a libpayload defconfig need to clear the `$(LIBPAYLOAD_DEFCONFIG)` variable and manually run the respective config target to generate a `.config`. To fully support this, the rule to create a `.config` via `defconfig` is guarded by `$(LIBPAYLOAD_DEFCONFIG)`. Otherwise we'd have a spurious, broken recipe when the variable is unset. We keep the option to call libpayload targets with an `lp-` prefix for convenience. The existing, explicit targets `lp-defconfig` and `lp-oldconfig` are replaced with a pattern match, so all config and other targets should work. Change-Id: Ie3fcce58d98e248c7182cd47f2a797fe066dd18a Signed-off-by: Nico Huber Reviewed-on: https://review.coreboot.org/c/coreboot/+/62273 Tested-by: build bot (Jenkins) Reviewed-by: Thomas Heijligen --- payloads/libpayload/Makefile.payload | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/payloads/libpayload/Makefile.payload b/payloads/libpayload/Makefile.payload index 421d96b373..3dea9f2998 100644 --- a/payloads/libpayload/Makefile.payload +++ b/payloads/libpayload/Makefile.payload @@ -122,26 +122,26 @@ LIBPAYLOAD_OPTS += DOTCONFIG="$(LIBPAYLOAD_DOTCONFIG)" LIBPAYLOAD_OPTS += CONFIG_=CONFIG_LP_ LIBPAYLOAD_OPTS += $(if $(CCACHE),CONFIG_LP_CCACHE=y) -defconfig: lp-defconfig -lp-defconfig: $(LIBPAYLOAD_DOTCONFIG) -$(LIBPAYLOAD_DOTCONFIG): $(LIBPAYLOAD_DEFCONFIG) | $(PAYLOAD_DEPS) +ifneq ($(LIBPAYLOAD_DEFCONFIG),) +$(LIBPAYLOAD_DOTCONFIG): $(LIBPAYLOAD_DEFCONFIG) $(MAKE) -C $(LIBPAYLOAD_SRC) $(LIBPAYLOAD_OPTS) \ KBUILD_DEFCONFIG=$(LIBPAYLOAD_DEFCONFIG) defconfig +endif $(LIBPAYLOAD_CONFIG_H): $(LIBPAYLOAD_DOTCONFIG) $(MAKE) -C $(LIBPAYLOAD_SRC) $(LIBPAYLOAD_OPTS) $(LIBPAYLOAD_CONFIG_H) -oldconfig: lp-oldconfig -lp-oldconfig: - [ ! -f $(LIBPAYLOAD_DOTCONFIG) ] || \ - $(MAKE) -C $(LIBPAYLOAD_SRC) $(LIBPAYLOAD_OPTS) oldconfig +force-relay: -$(LIBPAYLOAD): lp-defconfig | $(LIBPAYLOAD_CONFIG_H) +lp-%: force-relay + $(MAKE) -C $(LIBPAYLOAD_SRC) $(LIBPAYLOAD_OPTS) $* + +$(LIBPAYLOAD): force-relay | $(LIBPAYLOAD_CONFIG_H) $(MAKE) -C $(LIBPAYLOAD_SRC) $(LIBPAYLOAD_OPTS) $(shell mkdir -p $(sort $(dir $(OBJS)))) -.PHONY: oldconfig lp-oldconfig defconfig lp-defconfig +.PHONY: force-relay else # %clean,$(MAKECMDGOALS)