From patchwork Wed Dec 11 11:01:29 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 299974 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id DCC0C2C009E for ; Wed, 11 Dec 2013 22:03:56 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id EEAD74B057; Wed, 11 Dec 2013 12:03:51 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 0Ocy+D7JL8JL; Wed, 11 Dec 2013 12:03:51 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id EA3654B075; Wed, 11 Dec 2013 12:02:35 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 778B74B042 for ; Wed, 11 Dec 2013 12:02:23 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Jgrg1T0FCsQU for ; Wed, 11 Dec 2013 12:02:22 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from smtp.mei.co.jp (smtp.mei.co.jp [133.183.100.20]) by theia.denx.de (Postfix) with ESMTP id 9A5F44B044 for ; Wed, 11 Dec 2013 12:02:05 +0100 (CET) Received: from mail-gw.jp.panasonic.com ([157.8.1.157]) by smtp.mei.co.jp (8.12.11.20060614/3.7W/kc-maile11) with ESMTP id rBBB21Sk009080; Wed, 11 Dec 2013 20:02:01 +0900 (JST) Received: from epochmail.jp.panasonic.com ([157.8.1.130]) by mail.jp.panasonic.com (8.11.6p2/3.7W/kc-maili15) with ESMTP id rBBB21B30263; Wed, 11 Dec 2013 20:02:01 +0900 Received: by epochmail.jp.panasonic.com (8.12.11.20060308/3.7W/lomi11) id rBBB218Y006163; Wed, 11 Dec 2013 20:02:01 +0900 Received: from poodle by lomi11.jp.panasonic.com (8.12.11.20060308/3.7W) with ESMTP id rBBB21cN006062; Wed, 11 Dec 2013 20:02:01 +0900 Received: from beagle.diag.org (beagle.diag.org [10.184.179.16]) by poodle (Postfix) with ESMTP id 3A2F52743A5D; Wed, 11 Dec 2013 20:02:01 +0900 (JST) From: Masahiro Yamada To: u-boot@lists.denx.de Date: Wed, 11 Dec 2013 20:01:29 +0900 Message-Id: <1386759716-5322-8-git-send-email-yamada.m@jp.panasonic.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1386759716-5322-1-git-send-email-yamada.m@jp.panasonic.com> References: <1386759716-5322-1-git-send-email-yamada.m@jp.panasonic.com> Cc: Tom Rini Subject: [U-Boot] [PATCH 07/34] Makfile: move suffix rules to Makefile.build X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de This commit moves suffix rules from config.mk to scripts/Makefile.build, which will allow us to switch smoothly to real Kbuild. Note1: post/lib_powerpc/fpu/Makefile has its own rule to compile C sources. We need to tweak it to keep the same behavior. Note2: There are two file2 with the same name: arch/arm/lib/crt0.S and eamples/api/crt0.S. To keep the same build behavior, examples/api/Makefile also has to be treaked. Signed-off-by: Masahiro Yamada --- config.mk | 35 ----------------------------------- examples/api/Makefile | 4 ++-- post/lib_powerpc/fpu/Makefile | 2 +- scripts/Makefile.build | 31 +++++++++++++++++++++++++++++++ 4 files changed, 34 insertions(+), 38 deletions(-) diff --git a/config.mk b/config.mk index 07afb35..b08be7a 100644 --- a/config.mk +++ b/config.mk @@ -318,38 +318,3 @@ endif export HOSTCC HOSTCFLAGS HOSTLDFLAGS CROSS_COMPILE \ AS LD CC CPP AR NM STRIP OBJCOPY OBJDUMP MAKE export CONFIG_SYS_TEXT_BASE PLATFORM_CPPFLAGS PLATFORM_RELFLAGS CPPFLAGS CFLAGS AFLAGS - -######################################################################### - -# Allow boards to use custom optimize flags on a per dir/file basis -ALL_AFLAGS = $(AFLAGS) $(AFLAGS_$(BCURDIR)/$(@F)) $(AFLAGS_$(BCURDIR)) -ALL_CFLAGS = $(CFLAGS) $(CFLAGS_$(BCURDIR)/$(@F)) $(CFLAGS_$(BCURDIR)) -EXTRA_CPPFLAGS = $(CPPFLAGS_$(BCURDIR)/$(@F)) $(CPPFLAGS_$(BCURDIR)) -ALL_CFLAGS += $(EXTRA_CPPFLAGS) - -# The _DEP version uses the $< file target (for dependency generation) -# See rules.mk -EXTRA_CPPFLAGS_DEP = $(CPPFLAGS_$(BCURDIR)/$(addsuffix .o,$(basename $<))) \ - $(CPPFLAGS_$(BCURDIR)) -$(obj)%.s: %.S - $(CPP) $(ALL_AFLAGS) -o $@ $< -$(obj)%.o: %.S - $(CC) $(ALL_AFLAGS) -o $@ $< -c -$(obj)%.o: %.c -ifneq ($(CHECKSRC),0) - $(CHECK) $(CHECKFLAGS) $(ALL_CFLAGS) $< -endif - $(CC) $(ALL_CFLAGS) -o $@ $< -c -$(obj)%.i: %.c - $(CPP) $(ALL_CFLAGS) -o $@ $< -c -$(obj)%.s: %.c - $(CC) $(ALL_CFLAGS) -o $@ $< -c -S - -######################################################################### - -# If the list of objects to link is empty, just create an empty built-in.o -cmd_link_o_target = $(if $(strip $1),\ - $(LD) $(LDFLAGS) -r -o $@ $1,\ - rm -f $@; $(AR) rcs $@ ) - -######################################################################### diff --git a/examples/api/Makefile b/examples/api/Makefile index f770859..52f4368 100644 --- a/examples/api/Makefile +++ b/examples/api/Makefile @@ -50,9 +50,9 @@ $(obj)demo.bin: $(obj)demo $(OBJCOPY) -O binary $< $@ 2>/dev/null # Rule to build generic library C files -$(obj)%.o: $(SRCTREE)/lib/%.c +$(addprefix $(obj),$(notdir $(EXT_COBJ_FILES-y))): $(obj)%.o: $(SRCTREE)/lib/%.c $(CC) -g $(CFLAGS) -c -o $@ $< # Rule to build architecture-specific library assembly files -$(obj)%.o: $(SRCTREE)/arch/$(ARCH)/lib/%.S +$(addprefix $(obj),$(notdir $(EXT_SOBJ_FILES-y))): $(obj)%.o: $(SRCTREE)/arch/$(ARCH)/lib/%.S $(CC) -g $(CFLAGS) -c -o $@ $< diff --git a/post/lib_powerpc/fpu/Makefile b/post/lib_powerpc/fpu/Makefile index ae56a82..a7aa5bc 100644 --- a/post/lib_powerpc/fpu/Makefile +++ b/post/lib_powerpc/fpu/Makefile @@ -18,7 +18,7 @@ obj-y += darwin-ldouble.o CFLAGS := $(shell echo $(CFLAGS) | sed s/-msoft-float//) CFLAGS += -mhard-float -fkeep-inline-functions -$(obj)%.o: %.c +$(addprefix $(obj),$(obj-y)): $(obj)%.o: %.c $(CC) $(ALL_CFLAGS) -o $@.fp $< -c $(OBJCOPY) -R .gnu.attributes $@.fp $@ rm -f $@.fp diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 50c0394..1b3d77f 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -67,6 +67,37 @@ endif ######################################################################### +# Allow boards to use custom optimize flags on a per dir/file basis +ALL_AFLAGS = $(AFLAGS) $(AFLAGS_$(BCURDIR)/$(@F)) $(AFLAGS_$(BCURDIR)) +ALL_CFLAGS = $(CFLAGS) $(CFLAGS_$(BCURDIR)/$(@F)) $(CFLAGS_$(BCURDIR)) +EXTRA_CPPFLAGS = $(CPPFLAGS_$(BCURDIR)/$(@F)) $(CPPFLAGS_$(BCURDIR)) +ALL_CFLAGS += $(EXTRA_CPPFLAGS) + +# The _DEP version uses the $< file target (for dependency generation) +# See rules.mk +EXTRA_CPPFLAGS_DEP = $(CPPFLAGS_$(BCURDIR)/$(addsuffix .o,$(basename $<))) \ + $(CPPFLAGS_$(BCURDIR)) +$(obj)%.s: %.S + $(CPP) $(ALL_AFLAGS) -o $@ $< +$(obj)%.o: %.S + $(CC) $(ALL_AFLAGS) -o $@ $< -c +$(obj)%.o: %.c +ifneq ($(CHECKSRC),0) + $(CHECK) $(CHECKFLAGS) $(ALL_CFLAGS) $< +endif + $(CC) $(ALL_CFLAGS) -o $@ $< -c +$(obj)%.i: %.c + $(CPP) $(ALL_CFLAGS) -o $@ $< -c +$(obj)%.s: %.c + $(CC) $(ALL_CFLAGS) -o $@ $< -c -S + +# If the list of objects to link is empty, just create an empty built-in.o +cmd_link_o_target = $(if $(strip $1),\ + $(LD) $(LDFLAGS) -r -o $@ $1,\ + rm -f $@; $(AR) rcs $@ ) + +######################################################################### + # defines $(obj).depend target include $(TOPDIR)/rules.mk