From 07580605eabd8655a621eca0070f9e68558392d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Benn=C3=A9e?= <alex.bennee@linaro.org> Date: Fri, 7 Jul 2017 14:26:51 +0100 Subject: [PATCH] common.mk: allow user to override launch-terminal in make run MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently the code is hard coded to launch netcat via either xterm or gnome-terminal. This is a little inflexible for people who spend a lot of time in terminals. With the following you can now do: env QEMU_PATH=~/lsrc/qemu/qemu.git/ \ LAUNCH_TERMINAL="tmux split-window" \ make -j run To bring your nc instances up in new tmux windows. The one downside is titles aren't set as that wouldn't be maximally flexible for whatever your launch command is. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Acked-by: Joakim Bech <joakim.bech@linaro.org> --- common.mk | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/common.mk b/common.mk index c13f16c..35d73a6 100644 --- a/common.mk +++ b/common.mk @@ -228,6 +228,12 @@ define run-help @echo endef +ifneq ("", $(LAUNCH_TERMINAL)) +define launch-terminal + @nc -z 127.0.0.1 $(1) || \ + $(LAUNCH_TERMINAL) $(SOC_TERM_PATH)/soc_term $(1) & +endef +else gnome-terminal := $(shell command -v gnome-terminal 2>/dev/null) xterm := $(shell command -v xterm 2>/dev/null) ifdef gnome-terminal @@ -247,6 +253,7 @@ else check-terminal := @echo "Error: could not find gnome-terminal nor xterm" ; false endif endif +endif define wait-for-ports @while ! nc -z 127.0.0.1 $(1) || ! nc -z 127.0.0.1 $(2); do sleep 1; done -- GitLab