1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

makefiles: Sort >/dev/null and 2>&1

Redirecting `2>&1 >/dev/null` moves stderr to stdout first and then
stdout to /dev/null; when checking for command existence or otherwise
silencing output, this is usually not desired (but only starts producing
errors when the actual command fails, which is often not tested).
This commit is contained in:
chrysn 2021-08-24 14:39:04 +02:00
parent 16f7c94875
commit 648e014184
4 changed files with 8 additions and 8 deletions

View File

@ -327,12 +327,12 @@ APPLICATION := $(strip $(APPLICATION))
ifeq (,$(and $(DOWNLOAD_TO_STDOUT),$(DOWNLOAD_TO_FILE))) ifeq (,$(and $(DOWNLOAD_TO_STDOUT),$(DOWNLOAD_TO_FILE)))
ifeq (,$(WGET)) ifeq (,$(WGET))
ifeq (0,$(shell which wget 2>&1 > /dev/null ; echo $$?)) ifeq (0,$(shell which wget > /dev/null 2>&1 ; echo $$?))
WGET := $(shell which wget) WGET := $(shell which wget)
endif endif
endif endif
ifeq (,$(CURL)) ifeq (,$(CURL))
ifeq (0,$(shell which curl 2>&1 > /dev/null ; echo $$?)) ifeq (0,$(shell which curl > /dev/null 2>&1 ; echo $$?))
CURL := $(shell which curl) CURL := $(shell which curl)
endif endif
endif endif
@ -349,10 +349,10 @@ ifeq (,$(and $(DOWNLOAD_TO_STDOUT),$(DOWNLOAD_TO_FILE)))
endif endif
ifeq (,$(UNZIP_HERE)) ifeq (,$(UNZIP_HERE))
ifeq (0,$(shell which unzip 2>&1 > /dev/null ; echo $$?)) ifeq (0,$(shell which unzip > /dev/null 2>&1 ; echo $$?))
UNZIP_HERE := $(shell which unzip) -q UNZIP_HERE := $(shell which unzip) -q
else else
ifeq (0,$(shell which 7z 2>&1 > /dev/null ; echo $$?)) ifeq (0,$(shell which 7z > /dev/null 2>&1 ; echo $$?))
UNZIP_HERE := $(shell which 7z) x -bd UNZIP_HERE := $(shell which 7z) x -bd
else else
$(error Neither unzip nor 7z is installed.) $(error Neither unzip nor 7z is installed.)
@ -714,7 +714,7 @@ endef
# This is not the case on MacOSX, so it must be built on the fly # This is not the case on MacOSX, so it must be built on the fly
ifeq ($(OS),Darwin) ifeq ($(OS),Darwin)
ifneq (,$(filter debug, $(MAKECMDGOALS))) ifneq (,$(filter debug, $(MAKECMDGOALS)))
ifneq (0,$(shell command -v setsid 2>&1 > /dev/null ; echo $$?)) ifneq (0,$(shell command -v setsid > /dev/null 2>&1 ; echo $$?))
SETSID = $(RIOTTOOLS)/setsid/setsid SETSID = $(RIOTTOOLS)/setsid/setsid
$(call target-export-variables,debug,$(SETSID)) $(call target-export-variables,debug,$(SETSID))
DEBUGDEPS += $(SETSID) DEBUGDEPS += $(SETSID)

View File

@ -1,5 +1,5 @@
# new versions of gdb will support all architectures in one binary # new versions of gdb will support all architectures in one binary
ifeq ($(shell gdb-multiarch -v 2>&1 > /dev/null; echo $$?),0) ifeq ($(shell gdb-multiarch -v > /dev/null 2>&1; echo $$?),0)
export GDB ?= gdb-multiarch export GDB ?= gdb-multiarch
else else
export GDBPREFIX ?= $(PREFIX) export GDBPREFIX ?= $(PREFIX)

View File

@ -3,7 +3,7 @@
-include makefiles/color.inc.mk -include makefiles/color.inc.mk
riotgen-installed: riotgen-installed:
@command -v riotgen 2>&1 > /dev/null || \ @command -v riotgen > /dev/null 2>&1 || \
{ $(COLOR_ECHO) \ { $(COLOR_ECHO) \
"$(COLOR_RED)'riotgen' command is not available \ "$(COLOR_RED)'riotgen' command is not available \
please consider installing it from \ please consider installing it from \

View File

@ -2,7 +2,7 @@ INCLUDES += -I$(PKGDIRBASE)/flatbuffers/include
FLATC ?= flatc FLATC ?= flatc
ifneq (0,$(shell which flatc 2>&1 > /dev/null ; echo $$?)) ifneq (0,$(shell which flatc > /dev/null 2>&1 ; echo $$?))
FLATC = $(RIOTTOOLS)/flatc/flatc FLATC = $(RIOTTOOLS)/flatc/flatc
$(call target-export-variables,all,FLATC) $(call target-export-variables,all,FLATC)
endif endif