[U-Boot] [PATCH 24/34] Kbuild: convert some make rules to Kbuild style

Masahiro Yamada yamada.m at jp.panasonic.com
Wed Dec 11 12:01:46 CET 2013


We can get Kbuild-ish log style like this:
  GEN     include/autoconf.mk
  GEN     include/autoconf.mk.dep

We do not need XECHO any more.

Signed-off-by: Masahiro Yamada <yamada.m at jp.panasonic.com>
---

 Makefile | 70 ++++++++++++++++++++++++++++++++++++----------------------------
 1 file changed, 39 insertions(+), 31 deletions(-)

diff --git a/Makefile b/Makefile
index 3895364..2fae092 100644
--- a/Makefile
+++ b/Makefile
@@ -206,12 +206,6 @@ export	HOSTARCH HOSTOS
 VENDOR=
 
 #########################################################################
-# Allow for silent builds
-ifeq (,$(findstring s,$(MAKEFLAGS)))
-XECHO = echo
-else
-XECHO = :
-endif
 
 # The "tools" are needed early, so put this first
 # Don't include stuff already done in $(LIBS)
@@ -939,52 +933,63 @@ checkdtc:
 # This target actually generates 2 files; autoconf.mk and autoconf.mk.dep.
 # the dep file is only include in this top level makefile to determine when
 # to regenerate the autoconf.mk file.
+
+quiet_cmd_autoconf_dep = GEN     $@
+      cmd_autoconf_dep = $(CC) -x c -DDO_DEPS_ONLY -M $(c_flags) \
+	-MQ include/autoconf.mk $(srctree)/include/common.h > $@ || rm $@
+
 include/autoconf.mk.dep: include/config.h include/common.h
-	@$(XECHO) Generating $@ ; \
-	: Generate the dependancies ; \
-	$(CC) -x c -DDO_DEPS_ONLY -M $(c_flags) \
-		-MQ include/autoconf.mk $(srctree)/include/common.h > $@ || \
-		rm $@
+	$(call cmd,autoconf_dep)
 
-include/autoconf.mk: include/config.h
-	@$(XECHO) Generating $@ ; \
-	: Extract the config macros ; \
+quiet_cmd_autoconf = GEN     $@
+      cmd_autoconf = \
 	$(CPP) $(c_flags) -DDO_DEPS_ONLY -dM $(srctree)/include/common.h > $@.tmp && \
-		sed -n -f $(srctree)/tools/scripts/define2mk.sed $@.tmp > $@; \
+	sed -n -f $(srctree)/tools/scripts/define2mk.sed $@.tmp > $@; \
 	rm $@.tmp
 
+include/autoconf.mk: include/config.h
+	$(call cmd,autoconf)
+
 # Auto-generate the spl-autoconf.mk file (which is included by all makefiles for SPL)
-include/tpl-autoconf.mk: include/config.h
-	@$(XECHO) Generating $@ ; \
-	: Extract the config macros ; \
+quiet_cmd_tpl-autoconf = GEN     $@
+      cmd_tpl-autoconf = \
 	$(CPP) $(c_flags) -DCONFIG_TPL_BUILD  -DCONFIG_SPL_BUILD\
 			-DDO_DEPS_ONLY -dM $(srctree)/include/common.h > $@.tmp && \
 		sed -n -f $(srctree)/tools/scripts/define2mk.sed $@.tmp > $@; \
 	rm $@.tmp
 
-include/spl-autoconf.mk: include/config.h
-	@$(XECHO) Generating $@ ; \
-	: Extract the config macros ; \
+include/tpl-autoconf.mk: include/config.h
+	$(call cmd,tpl-autoconf)
+
+quiet_cmd_spl-autoconf = GEN     $@
+      cmd_spl-autoconf = \
 	$(CPP) $(c_flags) -DCONFIG_SPL_BUILD -DDO_DEPS_ONLY -dM $(srctree)/include/common.h > $@.tmp && \
 		sed -n -f $(srctree)/tools/scripts/define2mk.sed $@.tmp > $@; \
 	rm $@.tmp
 
+include/spl-autoconf.mk: include/config.h
+	$(call cmd,spl-autoconf)
+
+quiet_cmd_offsets = GEN     $@
+      cmd_offsets = $(srctree)/tools/scripts/make-asm-offsets $< $@
+
 include/generated/generic-asm-offsets.h: lib/asm-offsets.s
-	@$(XECHO) Generating $@
-	$(srctree)/tools/scripts/make-asm-offsets lib/asm-offsets.s $@
+	$(call cmd,offsets)
 
-lib/asm-offsets.s: include/config.h $(srctree)/lib/asm-offsets.c
-	@mkdir -p lib
-	$(CC) -DDO_DEPS_ONLY \
+quiet_cmd_asm-offsets.s = CC      $@
+      cmd_asm-offsets.s = mkdir -p lib; \
+		$(CC) -DDO_DEPS_ONLY \
 		$(c_flags) $(CFLAGS_$(BCURDIR)/$(@F)) $(CFLAGS_$(BCURDIR)) \
-		-o $@ $(srctree)/lib/asm-offsets.c -c -S
+		-o $@ $< -c -S
+
+lib/asm-offsets.s: $(srctree)/lib/asm-offsets.c include/config.h
+	$(call cmd,asm-offsets.s)
 
 include/generated/asm-offsets.h: $(CPUDIR)/$(SOC)/asm-offsets.s
-	@$(XECHO) Generating $@
-	$(srctree)/tools/scripts/make-asm-offsets $(CPUDIR)/$(SOC)/asm-offsets.s $@
+	$(call cmd,offsets)
 
-$(CPUDIR)/$(SOC)/asm-offsets.s:	include/config.h
-	@mkdir -p $(CPUDIR)/$(SOC)
+quiet_cmd_soc_asm-offsets.s = CC      $@
+      cmd_soc_asm-offsets.s = mkdir -p $(CPUDIR)/$(SOC); \
 	if [ -f $(srctree)/$(CPUDIR)/$(SOC)/asm-offsets.c ];then \
 		$(CC) -DDO_DEPS_ONLY \
 		$(c_flags) $(CFLAGS_$(BCURDIR)/$(@F)) $(CFLAGS_$(BCURDIR)) \
@@ -993,6 +998,9 @@ $(CPUDIR)/$(SOC)/asm-offsets.s:	include/config.h
 		touch $@; \
 	fi
 
+$(CPUDIR)/$(SOC)/asm-offsets.s:	include/config.h
+	$(call cmd,soc_asm-offsets.s)
+
 #########################################################################
 else	# !config.mk
 all u-boot.hex u-boot.srec u-boot.bin \
-- 
1.8.3.2



More information about the U-Boot mailing list