Skip to content

Commit 5410ecc

Browse files
vapiersravnborg
authored andcommitted
kbuild: introduce $(kecho) convenience echo
There is a bunch of places in the build system where we do 'echo' to show some nice status lines. This means we still get output when running in silent mode. So declare a new KECHO variable that only does 'echo' when we are in a suitable verbose build mode. Signed-off-by: Mike Frysinger <vapier@gentoo.org> [sam: added Documentation] Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
1 parent d03fab4 commit 5410ecc

2 files changed

Lines changed: 21 additions & 0 deletions

File tree

Documentation/kbuild/makefiles.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,20 @@ more details, with real examples.
383383
to prerequisites are referenced with $(src) (because they are not
384384
generated files).
385385

386+
$(kecho)
387+
echoing information to user in a rule is often a good practice
388+
but when execution "make -s" one does not expect to see any output
389+
except for warnings/errors.
390+
To support this kbuild define $(kecho) which will echo out the
391+
text following $(kecho) to stdout except if "make -s" is used.
392+
393+
Example:
394+
#arch/blackfin/boot/Makefile
395+
$(obj)/vmImage: $(obj)/vmlinux.gz
396+
$(call if_changed,uimage)
397+
@$(kecho) 'Kernel: $@ is ready'
398+
399+
386400
--- 3.11 $(CC) support functions
387401

388402
The kernel may be built with several different versions of

scripts/Kbuild.include

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@ basetarget = $(basename $(notdir $@))
2424
# Escape single quote for use in echo statements
2525
escsq = $(subst $(squote),'\$(squote)',$1)
2626

27+
###
28+
# Easy method for doing a status message
29+
kecho := :
30+
quiet_kecho := echo
31+
silent_kecho := :
32+
kecho := $($(quiet)kecho)
33+
2734
###
2835
# filechk is used to check if the content of a generated file is updated.
2936
# Sample usage:

0 commit comments

Comments
 (0)