From fe9704dbd6b27dee8e0433b4ae64ab2a43a6a0f0 Mon Sep 17 00:00:00 2001 From: Juan Carrano Date: Tue, 6 Nov 2018 18:59:15 +0100 Subject: [PATCH] makefiles/tools/serial: ensure PORT is set and fail early. By ensuring the PORT auto-detection worked, we can give meaningful error messages and fail earlier. This uses ensure_value from makefiles/utils/checks.mk. An include was added to Makefile.include to make this fuction available to all other makefiles. --- Makefile.include | 3 +++ makefiles/tools/serial.inc.mk | 7 ++----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile.include b/Makefile.include index da39ecaadf..b93ab1d273 100644 --- a/Makefile.include +++ b/Makefile.include @@ -106,6 +106,9 @@ OS := $(shell uname) # set python path, e.g. for tests PYTHONPATH := $(RIOTBASE)/dist/pythonlibs/:$(PYTHONPATH) +# Basic utilities included before anything else +include $(RIOTMAKE)/utils/checks.mk + # Include Docker settings near the top because we need to build the environment # command line before some of the variable origins are overwritten below when # using abspath, strip etc. diff --git a/makefiles/tools/serial.inc.mk b/makefiles/tools/serial.inc.mk index 215a5057e8..84144166e0 100644 --- a/makefiles/tools/serial.inc.mk +++ b/makefiles/tools/serial.inc.mk @@ -1,12 +1,9 @@ # set default port depending on operating system OS := $(shell uname) ifeq ($(OS),Linux) - PORT ?= $(PORT_LINUX) + PORT ?= $(call ensure_value,$(PORT_LINUX),No port set) else ifeq ($(OS),Darwin) - PORT ?= $(PORT_DARWIN) -endif -ifeq ($(PORT),) - $(info Warning: no PORT set!) + PORT ?= $(call ensure_value,$(PORT_DARWIN),No port set) endif export BAUD ?= 115200