diff options
author | Michael Olbrich <m.olbrich@pengutronix.de> | 2021-05-31 08:56:07 +0200 |
---|---|---|
committer | Michael Olbrich <m.olbrich@pengutronix.de> | 2021-05-31 09:16:36 +0200 |
commit | 2da8fa77e9f223743d41ef8e7dc5fe86eb41ff44 (patch) | |
tree | f051ca1ac24a8bceea73c77deae56dad32133e11 /rules/pre | |
parent | abc09b3a78f0a87e57215de25ff99b7e13f12b13 (diff) | |
download | ptxdist-2da8fa77e9f223743d41ef8e7dc5fe86eb41ff44.tar.gz ptxdist-2da8fa77e9f223743d41ef8e7dc5fe86eb41ff44.tar.xz |
rules: rework some error handling
There are several places where 'make' is aborted with an '$(error ...)'
immediately when starting ptxdist. It's useful to detect problems early on.
However, this means, that it also interferes with 'ptxdist print' to it can
make debugging issues a bit more tricky.
So collect the errors instead and print them in a early make target
instead.
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Diffstat (limited to 'rules/pre')
-rw-r--r-- | rules/pre/000-error.make | 22 | ||||
-rw-r--r-- | rules/pre/000-option-disabled.make | 2 | ||||
-rw-r--r-- | rules/pre/bootloader.make | 7 | ||||
-rw-r--r-- | rules/pre/kernel.make | 7 |
4 files changed, 29 insertions, 9 deletions
diff --git a/rules/pre/000-error.make b/rules/pre/000-error.make new file mode 100644 index 000000000..51e20881d --- /dev/null +++ b/rules/pre/000-error.make @@ -0,0 +1,22 @@ +# -*-makefile-*- +# +# Copyright (C) 2021 by Michael Olbrich <m.olbrich@pengutronix.de> +# +# For further information about the PTXdist project and license conditions +# see the README file. +# + + +define ptx/error +$(shell ptxd_make_log_error $(PTXDIST_TEMPDIR)/make-errors '$(lastword $(MAKEFILE_LIST))' '$(strip $(1))') +endef + +define ptx/have-errors +$(wildcard $(PTXDIST_TEMPDIR)/make-errors) +endef + +define ptx/report-errors +$(shell ptxd_make_report_errors $(PTXDIST_TEMPDIR)/make-errors) +endef + +# vim: syntax=make diff --git a/rules/pre/000-option-disabled.make b/rules/pre/000-option-disabled.make index 5bb63b01d..fa0e8a294 100644 --- a/rules/pre/000-option-disabled.make +++ b/rules/pre/000-option-disabled.make @@ -150,7 +150,7 @@ define ptx/config-foo $(strip $(if $($(strip $(1))), $(if $(call remove_quotes,$($(2))), $(call remove_quotes,$($(2))), - $(if $(filter update,$(3)),,$(error $(2) is undefined or empty))), + $(if $(filter update,$(3)),,$(call ptx/error, $(2) is undefined or empty))), undefined)) endef diff --git a/rules/pre/bootloader.make b/rules/pre/bootloader.make index 17f76723e..889dda415 100644 --- a/rules/pre/bootloader.make +++ b/rules/pre/bootloader.make @@ -12,10 +12,9 @@ ifdef PTXCONF_BOOTLOADER ifneq ($(PTXCONF_COMPILER_PREFIX),$(PTXCONF_COMPILER_PREFIX_BOOTLOADER)) ifeq ($(wildcard selected_toolchain_bootloader/$(PTXCONF_COMPILER_PREFIX_BOOTLOADER)gcc),) - $(warning *** no 'selected_toolchain_bootloader' link found. Please create a link) - $(warning *** 'selected_toolchain_bootloader' to the bin directory of your) - $(warning *** '$(PTXCONF_COMPILER_PREFIX_BOOTLOADER)' toolchain) - $(error ) + $(call ptx/error, no 'selected_toolchain_bootloader' link found. Please create a link) + $(call ptx/error, 'selected_toolchain_bootloader' to the bin directory of your) + $(call ptx/error, '$(PTXCONF_COMPILER_PREFIX_BOOTLOADER)' toolchain) endif BOOTLOADER_TOOLCHAIN_LINK := $(PTXDIST_WORKSPACE)/selected_toolchain_bootloader/ endif diff --git a/rules/pre/kernel.make b/rules/pre/kernel.make index 242b48c0c..f4cb5283b 100644 --- a/rules/pre/kernel.make +++ b/rules/pre/kernel.make @@ -94,10 +94,9 @@ PTXDIST_LOWLEVEL_WRAPPER_BLACKLIST := \ ifdef PTXCONF_KERNEL ifneq ($(PTXCONF_COMPILER_PREFIX),$(PTXCONF_COMPILER_PREFIX_KERNEL)) ifeq ($(wildcard selected_toolchain_kernel/$(PTXCONF_COMPILER_PREFIX_KERNEL)gcc),) - $(warning *** no 'selected_toolchain_kernel' link found. Please create a link) - $(warning *** 'selected_toolchain_kernel' to the bin directory of your) - $(warning '$(PTXCONF_COMPILER_PREFIX_KERNEL)' toolchain) - $(error ) + $(call ptx/error, no 'selected_toolchain_kernel' link found. Please create a link) + $(call ptx/error, 'selected_toolchain_kernel' to the bin directory of your) + $(call ptx/error, '$(PTXCONF_COMPILER_PREFIX_KERNEL)' toolchain) endif KERNEL_TOOLCHAIN_LINK := $(PTXDIST_WORKSPACE)/selected_toolchain_kernel/ endif |