diff mbox

[v2,5/5] kbuild: clean-up and bug fix of scripts/Makefile.host

Message ID 1402287394-31133-6-git-send-email-yamada.m@jp.panasonic.com (mailing list archive)
State New, archived
Headers show

Commit Message

Masahiro Yamada June 9, 2014, 4:16 a.m. UTC
Assume we have a Makefile like this:

  hostprogs-y := foo
  foo-cxxobjs := bar/baz.o
  foo-objs := qux/quux.o

In this case, Kbuild creates bar/ directory,
but fails to create qux/ directory.

This commit re-writes directory creation more simply,
fixing that bug.

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

Changes in v2:
  - More simplify host-objdirs

 scripts/Makefile.host | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

Comments

Michal Marek July 11, 2014, 1:46 p.m. UTC | #1
On 2014-06-09 06:16, Masahiro Yamada wrote:
> -# hostprogs-y := tools/build may have been specified. Retrieve directory
> -host-objdirs := $(dir $(__hostprogs))
> -# directory of .o files from prog-objs notation
> -host-objdirs += $(dir $(foreach f,$(host-cmulti), $($(f)-objs)))
> -# directory of .o files from prog-cxxobjs notation
> -host-objdirs += $(dir $(foreach f,$(host-cxxmulti), $($(f)-cxxobjs)))
> +# hostprogs-y := tools/build may have been specified.
> +# Retrieve also directory of .o files from prog-objs or prog-cxxobjs notation
> +host-objdirs := $(dir \
> +	     $(foreach f, $(__hostprogs), $(f) $($(f)-objs) $($(f)-cxxobjs)))

You could also use the $(host-cobjs) and $(host-cxxobjs) variables
defined earlier and write

host-objdirs := $(dir $(__hostprogs) $(host-cobjs) $(host-cxxobjs))

Michal
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Masahiro Yamada July 16, 2014, 7:16 a.m. UTC | #2
Hi Michal,



On Fri, 11 Jul 2014 15:46:44 +0200
Michal Marek <mmarek@suse.cz> wrote:

> On 2014-06-09 06:16, Masahiro Yamada wrote:
> > -# hostprogs-y := tools/build may have been specified. Retrieve directory
> > -host-objdirs := $(dir $(__hostprogs))
> > -# directory of .o files from prog-objs notation
> > -host-objdirs += $(dir $(foreach f,$(host-cmulti), $($(f)-objs)))
> > -# directory of .o files from prog-cxxobjs notation
> > -host-objdirs += $(dir $(foreach f,$(host-cxxmulti), $($(f)-cxxobjs)))
> > +# hostprogs-y := tools/build may have been specified.
> > +# Retrieve also directory of .o files from prog-objs or prog-cxxobjs notation
> > +host-objdirs := $(dir \
> > +	     $(foreach f, $(__hostprogs), $(f) $($(f)-objs) $($(f)-cxxobjs)))
> 
> You could also use the $(host-cobjs) and $(host-cxxobjs) variables
> defined earlier and write
> 
> host-objdirs := $(dir $(__hostprogs) $(host-cobjs) $(host-cxxobjs))
> 


Yup, this is much cleaner.
Fixed in v3.

Thanks!


Best Regards
Masahiro Yamada

--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/scripts/Makefile.host b/scripts/Makefile.host
index bb6a11f..064d825 100644
--- a/scripts/Makefile.host
+++ b/scripts/Makefile.host
@@ -43,12 +43,10 @@  host-cxxmulti	:= $(foreach m,$(__hostprogs),$(if $($(m)-cxxobjs),$(m)))
 host-cxxobjs	:= $(sort $(foreach m,$(host-cxxmulti),$($(m)-cxxobjs)))
 
 # output directory for programs/.o files
-# hostprogs-y := tools/build may have been specified. Retrieve directory
-host-objdirs := $(dir $(__hostprogs))
-# directory of .o files from prog-objs notation
-host-objdirs += $(dir $(foreach f,$(host-cmulti), $($(f)-objs)))
-# directory of .o files from prog-cxxobjs notation
-host-objdirs += $(dir $(foreach f,$(host-cxxmulti), $($(f)-cxxobjs)))
+# hostprogs-y := tools/build may have been specified.
+# Retrieve also directory of .o files from prog-objs or prog-cxxobjs notation
+host-objdirs := $(dir \
+	     $(foreach f, $(__hostprogs), $(f) $($(f)-objs) $($(f)-cxxobjs)))
 
 host-objdirs := $(strip $(sort $(filter-out ./,$(host-objdirs))))