mirror of
https://github.com/home-assistant/operating-system.git
synced 2025-12-20 02:18:37 +00:00
Implement better support for --silent flag in top-level Makefile (#4292)
The extra information printed when using the top-level makefile can clutter the output when it needs to be further processed, e.g. when running `make show-info | jq`. Make it respect the --silent flag (which also suppresses messages about changing directories which would break parsing as well).
This commit is contained in:
12
Makefile
12
Makefile
@@ -16,6 +16,12 @@ endif
|
|||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
|
SILENT := $(findstring s,$(word 1, $(MAKEFLAGS)))
|
||||||
|
|
||||||
|
define print
|
||||||
|
$(if $(SILENT),,$(info $1))
|
||||||
|
endef
|
||||||
|
|
||||||
COLOR_STEP := $(shell tput smso 2>/dev/null)
|
COLOR_STEP := $(shell tput smso 2>/dev/null)
|
||||||
COLOR_WARN := $(shell (tput setab 3; tput setaf 0) 2>/dev/null)
|
COLOR_WARN := $(shell (tput setab 3; tput setaf 0) 2>/dev/null)
|
||||||
TERM_RESET := $(shell tput sgr0 2>/dev/null)
|
TERM_RESET := $(shell tput sgr0 2>/dev/null)
|
||||||
@@ -28,7 +34,7 @@ TERM_RESET := $(shell tput sgr0 2>/dev/null)
|
|||||||
|
|
||||||
# fallback target when target undefined here is given
|
# fallback target when target undefined here is given
|
||||||
.DEFAULT:
|
.DEFAULT:
|
||||||
@echo "$(COLOR_STEP)=== Falling back to Buildroot target '$@' ===$(TERM_RESET)"
|
$(call print,$(COLOR_STEP)=== Falling back to Buildroot target '$@' ===$(TERM_RESET))
|
||||||
$(MAKE) -C $(BUILDROOT) O=$(O) BR2_EXTERNAL=$(BUILDROOT_EXTERNAL) "$@"
|
$(MAKE) -C $(BUILDROOT) O=$(O) BR2_EXTERNAL=$(BUILDROOT_EXTERNAL) "$@"
|
||||||
|
|
||||||
# default target when no target is given - must be first in Makefile
|
# default target when no target is given - must be first in Makefile
|
||||||
@@ -42,11 +48,11 @@ $(TARGETS_CONFIG): %-config:
|
|||||||
echo ""; \
|
echo ""; \
|
||||||
bash -c 'read -t 10 -p "Waiting 10s, press enter to continue or Ctrl-C to abort..."' || true; \
|
bash -c 'read -t 10 -p "Waiting 10s, press enter to continue or Ctrl-C to abort..."' || true; \
|
||||||
fi
|
fi
|
||||||
@echo "$(COLOR_STEP)=== Using $*_defconfig ===$(TERM_RESET)"
|
$(call print,$(COLOR_STEP)=== Using $*_defconfig ===$(TERM_RESET))
|
||||||
$(MAKE) -C $(BUILDROOT) O=$(O) BR2_EXTERNAL=$(BUILDROOT_EXTERNAL) "$*_defconfig"
|
$(MAKE) -C $(BUILDROOT) O=$(O) BR2_EXTERNAL=$(BUILDROOT_EXTERNAL) "$*_defconfig"
|
||||||
|
|
||||||
$(TARGETS): %: %-config
|
$(TARGETS): %: %-config
|
||||||
@echo "$(COLOR_STEP)=== Building $@ ===$(TERM_RESET)"
|
$(call print,$(COLOR_STEP)=== Building $@ ===$(TERM_RESET))
|
||||||
$(MAKE) -C $(BUILDROOT) O=$(O) BR2_EXTERNAL=$(BUILDROOT_EXTERNAL)
|
$(MAKE) -C $(BUILDROOT) O=$(O) BR2_EXTERNAL=$(BUILDROOT_EXTERNAL)
|
||||||
|
|
||||||
buildroot-help:
|
buildroot-help:
|
||||||
|
|||||||
Reference in New Issue
Block a user