defs.mk: Define Q and use it in *.mk

Define Q ?= @, and replace @<command> in recipes by $(Q)<command>.
Meant to be overridden from the environment for debugging as in

  Q= make

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2026-01-25 17:34:53 +01:00
commit f869b5aaca
15 changed files with 47 additions and 45 deletions

View file

@ -48,7 +48,7 @@ distclean: clean
# -- phony targets
checkroot:
@if [ "$(CHECK_ROOT)" = true -o "$(CHECK_ROOT)" = TRUE ] ; then \
$(Q)if [ "$(CHECK_ROOT)" = true -o "$(CHECK_ROOT)" = TRUE ] ; then \
echo "Error: You can only do this if either" ;\
echo " a) you are user \"root\"" ;\
echo " b) the Makefile variable CHECK_ROOT does not contain \"true\" as value." ;\
@ -235,11 +235,11 @@ ifneq ($(TARGET),mingw)
echo-ldd:
ifneq ($(wildcard *.so),)
@echo "======= libraries:"
@for o in *.so; do echo "------- $$o"; ldd $$o; done
$(Q)for o in *.so; do echo "------- $$o"; ldd $$o; done
endif
ifneq ($(EXE_PATH),)
@echo "======= executables:"
@for o in $(EXE_PATH); do echo "------- $$o"; ldd $$o; done
$(Q)for o in $(EXE_PATH); do echo "------- $$o"; ldd $$o; done
endif
endif
@ -338,7 +338,7 @@ $(PLUGIN) $(PLUGIN_LIB):
define check_not_empty
check_not_empty_$(1):
@if [ -z "$($(1))" ]; then \
$(Q)if [ -z "$($(1))" ]; then \
echo "$(1) is undefined" >&2 ;\
exit 1 ;\
fi
@ -391,7 +391,7 @@ $$(TOPDIR)/dir_install_$(1).done:
touch $$@
$$(BUILD_$(1)DIR)/%: % | $$(TOPDIR)/dir_build_$(1).done
@if [ ! $$< -ef $$@ -a "`echo $$< | $(SED) 's/\..*//'`" != local ]; then \
$(Q)if [ ! $$< -ef $$@ -a "`echo $$< | $(SED) 's/\..*//'`" != local ]; then \
echo $(BIN_INSTALL) -D -p -m $($(1)MODE) $$< $$@ ;\
$(BIN_INSTALL) -D -p -m $($(1)MODE) $$< $$@ ;\
$(RM) -f $$(TOPDIR)/dirs-*.done ;\
@ -427,7 +427,7 @@ $(INSTALLED_PROFILE_PATH_SCRIPT): $(TOPDIR)/profiledir.done
$(INSTALL) -p -o $(PROFILEOWNER) -g $(PROFILEGROUP) -m $(PROFILEMODE) path_script.sh $@
find:
@bash $(JWB_SCRIPT_DIR)/scm.sh ls-files
$(Q)bash $(JWB_SCRIPT_DIR)/scm.sh ls-files
collect:
bash $(JWB_SCRIPT_DIR)/collect-installed-pkg-changes.sh -t $(TOPDIR)