aboutsummaryrefslogtreecommitdiffstats
path: root/LUFA/Build/lufa.atprogram.in
diff options
context:
space:
mode:
Diffstat (limited to 'LUFA/Build/lufa.atprogram.in')
-rw-r--r--LUFA/Build/lufa.atprogram.in20
1 files changed, 10 insertions, 10 deletions
diff --git a/LUFA/Build/lufa.atprogram.in b/LUFA/Build/lufa.atprogram.in
index 59fedcd43..d7acc56ec 100644
--- a/LUFA/Build/lufa.atprogram.in
+++ b/LUFA/Build/lufa.atprogram.in
@@ -38,22 +38,22 @@ LUFA_BUILD_OPTIONAL_VARS += ATPROGRAM_PROGRAMMER ATPROGRAM_INTERFACE ATPROGRAM_
#
# -----------------------------------------------------------------------------
-# Sanity-check values of mandatory user-supplied variables
-MCU ?= $(error Makefile MCU value not set)
-TARGET ?= $(error Makefile TARGET value not set)
-
-ifeq ($(MCU),)
- $(error Makefile MCU option cannot be blank)
-endif
-ifeq ($(TARGET),)
- $(error Makefile TARGET option cannot be blank)
-endif
+ERROR_IF_UNSET = $(if $(filter undefined, $(origin $(strip $(1)))), $(error Makefile $(strip $(1)) value not set))
+ERROR_IF_EMPTY = $(if $(strip $($(strip $(1)))), , $(error Makefile $(strip $(1)) option cannot be blank))
+ERROR_IF_NONBOOL = $(if $(filter Y N, $($(strip $(1)))), , $(error Makefile $(strip $(1)) option must be Y or N))
# Default values of optionally user-supplied variables
ATPROGRAM_PROGRAMMER ?= jtagice3
ATPROGRAM_INTERFACE ?= jtag
ATPROGRAM_PORT ?=
+# Sanity check user supplied values
+$(foreach MANDATORY_VAR, $(LUFA_BUILD_MANDATORY_VARS), $(call ERROR_IF_UNSET, $(MANDATORY_VAR)))
+$(call ERROR_IF_EMPTY, MCU)
+$(call ERROR_IF_EMPTY, TARGET)
+$(call ERROR_IF_EMPTY, ATPROGRAM_PROGRAMMER)
+$(call ERROR_IF_EMPTY, ATPROGRAM_INTERFACE)
+
# Output Messages
MSG_ATPROGRAM_CMD := ' [ATPRGRM] :'