kbuild: convert some make rules to Kbuild style

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.

And also change checkstack target like Linux Kernel.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
This commit is contained in:
Masahiro Yamada 2014-02-04 17:24:31 +09:00 committed by Tom Rini
parent 5f30f3be73
commit 47f1571115

View file

@ -202,12 +202,6 @@ export HOSTARCH HOSTOS
VENDOR= VENDOR=
######################################################################### #########################################################################
# Allow for silent builds
ifeq (,$(findstring s,$(MAKEFLAGS)))
XECHO = echo
else
XECHO = :
endif
# The "tools" are needed early, so put this first # The "tools" are needed early, so put this first
# Don't include stuff already done in $(LIBS) # Don't include stuff already done in $(LIBS)
@ -909,10 +903,11 @@ TAG_SUBDIRS += include
FIND := find FIND := find
FINDFLAGS := -L FINDFLAGS := -L
PHONY += checkstack
checkstack: checkstack:
$(CROSS_COMPILE)objdump -d u-boot \ $(OBJDUMP) -d u-boot $$(find . -name u-boot-spl) | \
`$(FIND) . -name u-boot-spl -print` | \ $(PERL) $(src)/scripts/checkstack.pl $(ARCH)
perl $(src)/scripts/checkstack.pl $(ARCH)
tags ctags: tags ctags:
ctags -w -o ctags `$(FIND) $(FINDFLAGS) $(TAG_SUBDIRS) \ ctags -w -o ctags `$(FIND) $(FINDFLAGS) $(TAG_SUBDIRS) \
@ -962,52 +957,63 @@ checkdtc:
# This target actually generates 2 files; autoconf.mk and autoconf.mk.dep. # 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 # the dep file is only include in this top level makefile to determine when
# to regenerate the autoconf.mk file. # to regenerate the autoconf.mk file.
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 $@
include/autoconf.mk: include/config.h quiet_cmd_autoconf_dep = GEN $@
@$(XECHO) Generating $@ ; \ cmd_autoconf_dep = $(CC) -x c -DDO_DEPS_ONLY -M $(c_flags) \
: Extract the config macros ; \ -MQ include/autoconf.mk $(srctree)/include/common.h > $@ || rm $@
include/autoconf.mk.dep: include/config.h include/common.h
$(call cmd,autoconf_dep)
quiet_cmd_autoconf = GEN $@
cmd_autoconf = \
$(CPP) $(c_flags) -DDO_DEPS_ONLY -dM $(srctree)/include/common.h > $@.tmp && \ $(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 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) # Auto-generate the spl-autoconf.mk file (which is included by all makefiles for SPL)
include/tpl-autoconf.mk: include/config.h quiet_cmd_tpl-autoconf = GEN $@
@$(XECHO) Generating $@ ; \ cmd_tpl-autoconf = \
: Extract the config macros ; \
$(CPP) $(c_flags) -DCONFIG_TPL_BUILD -DCONFIG_SPL_BUILD\ $(CPP) $(c_flags) -DCONFIG_TPL_BUILD -DCONFIG_SPL_BUILD\
-DDO_DEPS_ONLY -dM $(srctree)/include/common.h > $@.tmp && \ -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 rm $@.tmp
include/spl-autoconf.mk: include/config.h include/tpl-autoconf.mk: include/config.h
@$(XECHO) Generating $@ ; \ $(call cmd,tpl-autoconf)
: Extract the config macros ; \
quiet_cmd_spl-autoconf = GEN $@
cmd_spl-autoconf = \
$(CPP) $(c_flags) -DCONFIG_SPL_BUILD -DDO_DEPS_ONLY -dM $(srctree)/include/common.h > $@.tmp && \ $(CPP) $(c_flags) -DCONFIG_SPL_BUILD -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 rm $@.tmp
include/generated/generic-asm-offsets.h: lib/asm-offsets.s include/spl-autoconf.mk: include/config.h
@$(XECHO) Generating $@ $(call cmd,spl-autoconf)
$(srctree)/tools/scripts/make-asm-offsets lib/asm-offsets.s $@
lib/asm-offsets.s: include/config.h $(srctree)/lib/asm-offsets.c quiet_cmd_offsets = GEN $@
@mkdir -p lib cmd_offsets = $(srctree)/tools/scripts/make-asm-offsets $< $@
$(CC) -DDO_DEPS_ONLY \
include/generated/generic-asm-offsets.h: lib/asm-offsets.s
$(call cmd,offsets)
quiet_cmd_asm-offsets.s = CC $@
cmd_asm-offsets.s = mkdir -p lib; \
$(CC) -DDO_DEPS_ONLY \
$(c_flags) $(CFLAGS_$(BCURDIR)/$(@F)) $(CFLAGS_$(BCURDIR)) \ $(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 include/generated/asm-offsets.h: $(CPUDIR)/$(SOC)/asm-offsets.s
@$(XECHO) Generating $@ $(call cmd,offsets)
$(srctree)/tools/scripts/make-asm-offsets $(CPUDIR)/$(SOC)/asm-offsets.s $@
$(CPUDIR)/$(SOC)/asm-offsets.s: include/config.h quiet_cmd_soc_asm-offsets.s = CC $@
@mkdir -p $(CPUDIR)/$(SOC) cmd_soc_asm-offsets.s = mkdir -p $(CPUDIR)/$(SOC); \
if [ -f $(srctree)/$(CPUDIR)/$(SOC)/asm-offsets.c ];then \ if [ -f $(srctree)/$(CPUDIR)/$(SOC)/asm-offsets.c ];then \
$(CC) -DDO_DEPS_ONLY \ $(CC) -DDO_DEPS_ONLY \
$(c_flags) $(CFLAGS_$(BCURDIR)/$(@F)) $(CFLAGS_$(BCURDIR)) \ $(c_flags) $(CFLAGS_$(BCURDIR)/$(@F)) $(CFLAGS_$(BCURDIR)) \
@ -1016,6 +1022,9 @@ $(CPUDIR)/$(SOC)/asm-offsets.s: include/config.h
touch $@; \ touch $@; \
fi fi
$(CPUDIR)/$(SOC)/asm-offsets.s: include/config.h
$(call cmd,soc_asm-offsets.s)
######################################################################### #########################################################################
else # !config.mk else # !config.mk
all u-boot.hex u-boot.srec u-boot.bin \ all u-boot.hex u-boot.srec u-boot.bin \