Skip to contentSkip to conversation

kbuild: introduce KECHO convenience echo

PATCH In review Mike Frysinger 3 participants 5 messages Nov 6, 2008 – Nov 21, 2008 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 scripts/Kbuild.include |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
scripts/Kbuild.include +7 -0
index 982dcae..9dc96cf 100644
@@ -25,6 +25,13 @@ basetarget = $(basename $(notdir $@))
 escsq = $(subst $(squote),'\$(squote)',$1)
 
 ###
+# Easy method for doing a status message
+       kecho = :
+ quiet_kecho = echo
+silent_kecho = :
+KECHO = $($(quiet)kecho)
+
+###
 # filechk is used to check if the content of a generated file is updated.
 # Sample usage:
 # define filechk_sample
Signature · 1 line
1.6.0.3
#1 lore raw

PATCH 1/1 kbuild: use KECHO convenience echo

Convert a few echos in the build system to new $(KECHO) so we get correct output according to build verbosity.

---
 Makefile                    |    6 +++---
 arch/blackfin/boot/Makefile |    2 +-
 scripts/Kbuild.include      |   11 ++---------
 3 files changed, 6 insertions(+), 13 deletions(-)
Makefile +3 -3
index 29abe62..3dd95c2 100644
@@ -983,7 +983,7 @@ endef
 # directory for generated filesas used by some architectures.
 define create-symlink
 	if [ ! -L include/asm ]; then                                      \
-			echo '  SYMLINK $@ -> include/asm-$(SRCARCH)';     \
+			$(KECHO) '  SYMLINK $@ -> include/asm-$(SRCARCH)'; \
 			if [ ! -d include/asm-$(SRCARCH) ]; then           \
 				mkdir -p include/asm-$(SRCARCH);           \
 			fi;                                                \
@@ -1096,7 +1096,7 @@ all: modules
 PHONY += modules
 modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux)
 	$(Q)$(AWK) '!x[$$0]++' $(vmlinux-dirs:%=$(objtree)/%/modules.order) > $(objtree)/modules.order
-	@echo '  Building modules, stage 2.';
+	@$(KECHO) '  Building modules, stage 2.';
 	$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
 	$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.fwinst obj=firmware __fw_modbuild
 
@@ -1360,7 +1360,7 @@ $(module-dirs): crmodverdir $(objtree)/Module.symvers
 	$(Q)$(MAKE) $(build)=$(patsubst _module_%,%,$@)
 
 modules: $(module-dirs)
-	@echo '  Building modules, stage 2.';
+	@$(KECHO) '  Building modules, stage 2.';
 	$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
 
 PHONY += modules_install
arch/blackfin/boot/Makefile +1 -1
index 522f3c1..25bb977 100644
@@ -25,7 +25,7 @@ $(obj)/vmlinux.gz: $(obj)/vmlinux.bin FORCE
 
 $(obj)/vmImage: $(obj)/vmlinux.gz
 	$(call if_changed,uimage)
-	@echo 'Kernel: $@ is ready'
+	@$(KECHO) 'Kernel: $@ is ready'
 
 install:
 	sh $(srctree)/$(src)/install.sh $(KERNELRELEASE) $(BOOTIMAGE) System.map "$(INSTALL_PATH)"
scripts/Kbuild.include +2 -9
index 9dc96cf..c992249 100644
@@ -46,22 +46,15 @@ KECHO = $($(quiet)kecho)
 # - If they are equal no change, and no timestamp update
 # - stdin is piped in from the first prerequisite ($<) so one has
 #   to specify a valid file as first prerequisite (often the kbuild file)
-       chk_filechk = :
- quiet_chk_filechk = echo '  CHK     $@'
-silent_chk_filechk = :
-       upd_filechk = :
- quiet_upd_filechk = echo '  UPD     $@'
-silent_upd_filechk = :
-
 define filechk
 	$(Q)set -e;				\
-	$($(quiet)chk_filechk);			\
+	$(KECHO) '  CHK     $@';		\
 	mkdir -p $(dir $@);			\
 	$(filechk_$(1)) < $< > [email protected];		\
 	if [ -r $@ ] && cmp -s $@ [email protected]; then	\
 		rm -f [email protected];			\
 	else					\
-		$($(quiet)upd_filechk);		\
+		$(KECHO) '  UPD     $@';	\
 		mv -f [email protected] $@;		\
 	fi
 endef
Signature · 1 line
1.6.0.3
#3 lore raw
In reply to Mike Frysinger
Quoted 4 lines · Mike Frysinger

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.

Nice idea.
I will add it as soon as I start working on kbuild-next Same for your other two patches.

A lot of the kbuild stuff today is using lowercase to avoid all the typical SCREAMING in Makefiles so I may end up using $(kecho).

Sam

#4 lore raw
Quoted 6 lines · Sam Ravnborg
Quoted 4 lines · Mike Frysinger

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.

Quoted 7 lines

Nice idea.
I will add it as soon as I start working on kbuild-next Same for your other two patches.

A lot of the kbuild stuff today is using lowercase to avoid all the typical SCREAMING in Makefiles so I may end up using $(kecho).

yeah i wasnt sure whether to use $(KECHO) or $(kecho) or just $(echo).
i'm really not partial to any :).
-mike