public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Masahiro Yamada <yamada.m@jp.panasonic.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v3 1/6] Makefile: support descending down to subdirectories
Date: Mon, 30 Sep 2013 17:23:33 +0900	[thread overview]
Message-ID: <1380529418-28532-2-git-send-email-yamada.m@jp.panasonic.com> (raw)
In-Reply-To: <1380529418-28532-1-git-send-email-yamada.m@jp.panasonic.com>

This patch tweaks scripts/Makefile.build to allow
the build system to descend into subdirectories like Kbuild.

To use this feature, use "obj-y += foo/" syntax.

Example:
    obj-$(CONFIG_FOO) += foo/

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>

---

Changes for v3:
  - No change

Changes for v2:
  - No change

 scripts/Makefile.build | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index f969ec5..2ef7341 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -19,6 +19,11 @@ obj-y := $(sort $(obj-y))
 extra-y := $(sort $(extra-y))
 lib-y := $(sort $(lib-y))
 
+subdir-y 	:= $(patsubst %/,%,$(filter %/, $(obj-y)))
+obj-y		:= $(patsubst %/, %/built-in.o, $(obj-y))
+subdir-obj-y	:= $(filter %/built-in.o, $(obj-y))
+subdir-obj-y	:= $(addprefix $(obj),$(subdir-obj-y))
+
 SRCS	+= $(COBJS:.o=.c) $(SOBJS:.o=.S) \
  $(wildcard $(obj-y:.o=.c) $(obj-y:.o=.S) $(lib-y:.o=.c) $(lib-y:.o=.S) $(extra-y:.o=.c) $(extra-y:.o=.S))
 OBJS	:= $(addprefix $(obj),$(COBJS) $(SOBJS) $(obj-y))
@@ -37,6 +42,14 @@ $(LIBGCC): $(obj).depend $(LGOBJS)
 	$(call cmd_link_o_target, $(LGOBJS))
 endif
 
+ifneq ($(subdir-obj-y),)
+# Descending
+$(subdir-obj-y): $(subdir-y)
+
+$(subdir-y): FORCE
+	$(MAKE) -C $@ -f $(TOPDIR)/scripts/Makefile.build
+endif
+
 #########################################################################
 
 # defines $(obj).depend target
@@ -46,3 +59,5 @@ include $(TOPDIR)/rules.mk
 sinclude $(obj).depend
 
 #########################################################################
+
+.PHONY: FORCE
-- 
1.8.1.2

  reply	other threads:[~2013-09-30  8:23 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-30  8:23 [U-Boot] [PATCH v3 0/6] Second step towards Kbuild: Descend down like Kbuild Masahiro Yamada
2013-09-30  8:23 ` Masahiro Yamada [this message]
2013-09-30  8:23 ` [U-Boot] [PATCH v3 2/6] drivers: move some drivers to drivers/Makefile Masahiro Yamada
2013-09-30  8:23 ` [U-Boot] [PATCH v3 3/6] fs: move some file system to fs/Makefile Masahiro Yamada
2013-09-30  8:23 ` [U-Boot] [PATCH v3 4/6] ARM: tegra: move Tegra specific code under arch/arm/ Masahiro Yamada
2013-09-30  8:23 ` [U-Boot] [PATCH v3 5/6] ARM: omap: move OMAP " Masahiro Yamada
2013-09-30  8:23 ` [U-Boot] [PATCH v3 6/6] ARM: s5pc, exynos: move Samsung ARM SoC " Masahiro Yamada
2013-10-03 23:51 ` [U-Boot] [PATCH v3 0/6] Second step towards Kbuild: Descend down like Kbuild Simon Glass
2013-10-04 10:37   ` Masahiro Yamada
2013-10-04 15:52     ` Simon Glass

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1380529418-28532-2-git-send-email-yamada.m@jp.panasonic.com \
    --to=yamada.m@jp.panasonic.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox