public inbox for linux-kbuild@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] let kbuild mkdir for dir/file.o
@ 2013-06-04  8:45 张忠山
  2013-06-04  8:45 ` 张忠山
  2013-06-14  5:39 ` zzs
  0 siblings, 2 replies; 15+ messages in thread
From: 张忠山 @ 2013-06-04  8:45 UTC (permalink / raw)
  To: linux-kbuild

Last week I send this patch, but no reply.
Now I try to explain it clearly:

When I try to add a file(which in a subdir) to my board's obj-y, the build progress crashed.

for example, I use at91rm9200ek board, and in kernel dir run:

	mkdir objtree
	make O=objtree at91rm9200-defconfig
	mkdir arch/arm/mach-at91/dir
	touch arch/arm/mach-at91/dir/file.c

and edit arch/arm/mach-at91/dir/file.c to add some code.
then edit arch/arm/mach-at91/Makefile, change the flowwing line:

	obj-$(CONFIG_MACH_AT91RM9200EK)	+= board-rm9200ek.o

to:

	obj-$(CONFIG_MACH_AT91RM9200EK)	+= board-rm9200ek.o dir/file.o

Now build it:

	make O=objtree

Then the error appears:
	...
	CC      arch/arm/mach-at91/board-rm9200dk.o
	CC      arch/arm/mach-at91/board-rm9200ek.o
	CC      arch/arm/mach-at91/dir/file.o
	linux-2.6/arch/arm/mach-at91/dir/file.c:5: fatal error: opening dependency file arch/arm/mach-at91/dir/.file.o.d: No such file or directory

Check the objtree:
	LANG=en ls objtree/arch/arm/mach-at91/dir
	ls: cannot access objtree/arch/arm/mach-at91/dir: No such file or directory

It's appearantly that the target dir not created for file.o

I check kbuild source code. It seems that kbuild create dirs for that in $(obj-dirs).
But if the dir need not to create a built-in.o, It should never in  $(obj-dirs).

So I make this patch to make sure It in  $(obj-dirs)

Anybody Anyidea?

张忠山 (1):
  let kbuild mkdir for dir/file.o

 scripts/Makefile.lib |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

-- 
1.7.9.5


^ permalink raw reply	[flat|nested] 15+ messages in thread
[parent not found: <1369807633-4364-1-git-send-email-zzs0213@gmail.com>]
* [PATCH] let kbuild mkdir for dir/file.o
@ 2013-05-29  6:10 张忠山
  0 siblings, 0 replies; 15+ messages in thread
From: 张忠山 @ 2013-05-29  6:10 UTC (permalink / raw)
  To: linux-kbuild

when add a obj with dir to obj-y, like this

    obj-y += dir/file.o

the $(obj)/dir not created, this patch fix this

this bug caused by commit
   f5fb976520a53f45f8bbf2e851f16b3b5558d485

Signed-off-by: 张忠山 <zzs0213@gmail.com>
---
 scripts/Makefile.lib |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 51bb3de..6bae5a9 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -63,7 +63,8 @@ multi-objs   := $(multi-objs-y) $(multi-objs-m)
 subdir-obj-y := $(filter %/built-in.o, $(obj-y))
 
 # $(obj-dirs) is a list of directories that contain object files
-obj-dirs := $(dir $(multi-objs) $(subdir-obj-y))
+__subdir-obj-y := $(foreach o,$(obj-y),$(if $(filter-out $(o),$(notdir $(o))),$(o)))
+obj-dirs := $(dir $(multi-objs) $(__subdir-obj-y))
 
 # Replace multi-part objects by their individual parts, look at local dir only
 real-objs-y := $(foreach m, $(filter-out $(subdir-obj-y), $(obj-y)), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m))) $(extra-y)
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 15+ messages in thread
* [PATCH] let kbuild mkdir for dir/file.o
@ 2013-05-28 10:14 zzs0213
  2013-05-29  3:42 ` zzs
  0 siblings, 1 reply; 15+ messages in thread
From: zzs0213 @ 2013-05-28 10:14 UTC (permalink / raw)
  To: linux-kbuild; +Cc: 张忠山, 张忠山

From: 张忠山 <zzs213@126.com>

when obj-y += dir/file.o
the $(obj)/dir not created, this patch fix this

this bug caused by commit
  f5fb976520a53f45f8bbf2e851f16b3b5558d485

Signed-off-by: 张忠山 <zzs0213@gmail.com>
---
 scripts/Makefile.lib |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 51bb3de..6bae5a9 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -63,7 +63,8 @@ multi-objs   := $(multi-objs-y) $(multi-objs-m)
 subdir-obj-y := $(filter %/built-in.o, $(obj-y))
 
 # $(obj-dirs) is a list of directories that contain object files
-obj-dirs := $(dir $(multi-objs) $(subdir-obj-y))
+__subdir-obj-y := $(foreach o,$(obj-y),$(if $(filter-out $(o),$(notdir $(o))),$(o)))
+obj-dirs := $(dir $(multi-objs) $(__subdir-obj-y))
 
 # Replace multi-part objects by their individual parts, look at local dir only
 real-objs-y := $(foreach m, $(filter-out $(subdir-obj-y), $(obj-y)), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m))) $(extra-y)
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2013-07-04  1:36 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-04  8:45 [PATCH] let kbuild mkdir for dir/file.o 张忠山
2013-06-04  8:45 ` 张忠山
2013-06-28 22:44   ` Michal Marek
2013-06-30  8:01     ` 张忠山
2013-06-30  9:02     ` 张忠山
2013-06-30  9:09     ` 张忠山
2013-07-03 20:49       ` Michal Marek
2013-07-04  1:35         ` 张忠山
2013-06-14  5:39 ` zzs
2013-06-23 21:59   ` Michal Marek
     [not found] <1369807633-4364-1-git-send-email-zzs0213@gmail.com>
2013-05-30  1:59 ` 张忠山
2013-05-30 18:59   ` Sam Ravnborg
  -- strict thread matches above, loose matches on Subject: below --
2013-05-29  6:10 张忠山
2013-05-28 10:14 zzs0213
2013-05-29  3:42 ` zzs

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox